Class InstructorsController
java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.InstructorsController
@RequestMapping("/api/admin/instructors")
@RestController
public class InstructorsController
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a list of all instructors, available only to Admins.org.springframework.http.ResponseEntity
<String> deleteInstructor
(String email) Delete an instructor by email, available only to Admins.postInstructor
(String email) Create a new Instructor, available only to Admins.Methods inherited from class edu.ucsb.cs156.frontiers.controllers.ApiController
doesCurrentUserHaveRole, genericMessage, getCurrentUser, handleEntityNotFoundException, handleIllegalArgument, handleNoLinkedOrgException, handleUnsupportedOperation, isCurrentUserAdmin
-
Constructor Details
-
InstructorsController
public InstructorsController()
-
-
Method Details
-
postInstructor
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Instructor postInstructor(@RequestParam String email) Create a new Instructor, available only to Admins.- Parameters:
email
- the email of the instructor- Returns:
- the created Instructor
-
allInstructors
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @GetMapping("/get") public Iterable<Instructor> allInstructors()Get a list of all instructors, available only to Admins.- Returns:
- a list of all instructors
-
deleteInstructor
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("/delete") public org.springframework.http.ResponseEntity<String> deleteInstructor(@RequestParam String email) Delete an instructor by email, available only to Admins.
-