Skip to content

Commit

Permalink
Turn on security for addCategory method
Browse files Browse the repository at this point in the history
  • Loading branch information
borabilgin committed Feb 1, 2019
1 parent ed8a505 commit 87047a6
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -5,6 +5,7 @@
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
Expand All @@ -18,6 +19,7 @@ public class FeedCategoryController {
private FeedService feedService; private FeedService feedService;


@RequestMapping(method = RequestMethod.PUT) @RequestMapping(method = RequestMethod.PUT)
@PreAuthorize("hasAuthority('ADMIN')")
public ResponseEntity<FeedCategory> addCategory(@RequestParam() String categoryName) { public ResponseEntity<FeedCategory> addCategory(@RequestParam() String categoryName) {
FeedCategory category = feedService.addCategory(categoryName); FeedCategory category = feedService.addCategory(categoryName);
return new ResponseEntity<>(category, HttpStatus.OK); return new ResponseEntity<>(category, HttpStatus.OK);
Expand Down

0 comments on commit 87047a6

Please sign in to comment.