Class ModeratorController
java.lang.Object
edu.ucsb.cs156.dining.controllers.ApiController
edu.ucsb.cs156.dining.controllers.ModeratorController
@RequestMapping("/api/admin/moderators")
@RestController
public class ModeratorController
extends ApiController
This is a REST controller for getting information about the moderators. These endpoints are only
accessible to moderators with the role "ROLE_ADMIN".
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a list of all Moderators, available only to Admins.org.springframework.http.ResponseEntity<String> deleteModerator(String email) Delete an Moderator by email, available only to Admins.postModerator(String email) Create a new Moderator, available only to Admins.Methods inherited from class edu.ucsb.cs156.dining.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException, handleUnsupportedOperation
-
Constructor Details
-
ModeratorController
public ModeratorController()
-
-
Method Details
-
postModerator
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Moderator postModerator(@RequestParam String email) Create a new Moderator, available only to Admins.- Parameters:
email- the email of the Moderator- Returns:
- the created Moderator
-
allModerators
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @GetMapping("/get") public Iterable<Moderator> allModerators()Get a list of all Moderators, available only to Admins.- Returns:
- a list of all Moderators
-
deleteModerator
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("/delete") public org.springframework.http.ResponseEntity<String> deleteModerator(@RequestParam String email) Delete an Moderator by email, available only to Admins.
-