Class ModeratorsController

java.lang.Object
edu.ucsb.cs156.dining.controllers.ApiController
edu.ucsb.cs156.dining.controllers.ModeratorsController

@RequestMapping("/api/admin/moderators") @RestController public class ModeratorsController extends ApiController
This is a REST controller for getting information about the moderators. These endpoints are only accessible to users with the role "ROLE_ADMIN".
  • Constructor Details

    • ModeratorsController

      public ModeratorsController()
  • 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 a moderator by email, available only to Admins.