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 instructors. These endpoints are only accessible to instructors with the role "ROLE_ADMIN".
  • Constructor Details

    • ModeratorController

      public ModeratorController()
  • Method Details

    • postInstructor

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Moderator postInstructor(@RequestParam String email)
      Create a new Moderator, available only to Admins.
      Parameters:
      email - the email of the Moderator
      Returns:
      the created Moderator
    • allInstructors

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @GetMapping("/get") public Iterable<Moderator> allInstructors()
      Get a list of all Moderators, available only to Admins.
      Returns:
      a list of all Moderators
    • deleteInstructor

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("/delete") public org.springframework.http.ResponseEntity<String> deleteInstructor(@RequestParam String email)
      Delete an Moderator by email, available only to Admins.