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 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.