Class CourseStaffController
java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.CourseStaffController
@RequestMapping("/api/coursestaff")
@RestController
public class CourseStaffController
extends ApiController
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncourseStaffForCourse(Long courseId) This method returns a list of course staff for a given course.org.springframework.http.ResponseEntity<String> deleteStaffMember(Long id, Long courseId, boolean removeFromOrg) static CourseStafffromStaffCSVRow(String[] row) static booleanhasStaffCSVHeaders(String[] headers) org.springframework.http.ResponseEntity<String> joinCourseOnGitHub(Long courseStaffId) postCourseStaff(String firstName, String lastName, String email, Long courseId) This method creates a new CourseStaff.updateStaffMember(Long courseId, Long id, String firstName, String lastName) org.springframework.http.ResponseEntity<List<CourseStaff>> uploadCourseStaffCSV(Long courseId, org.springframework.web.multipart.MultipartFile file) Methods inherited from class edu.ucsb.cs156.frontiers.controllers.ApiController
doesCurrentUserHaveRole, genericMessage, getCurrentUser, handleDuplicateGroupException, handleEntityNotFoundException, handleIllegalArgument, handleNoLinkedOrgException, handleUnsupportedOperation, handleValidationException, isCurrentUserAdmin
-
Field Details
-
STAFF_CSV_HEADERS
- See Also:
-
-
Constructor Details
-
CourseStaffController
public CourseStaffController()
-
-
Method Details
-
hasStaffCSVHeaders
-
fromStaffCSVRow
-
postCourseStaff
@PreAuthorize("@CourseSecurity.hasInstructorPermissions(#root, #courseId)") @PostMapping("/post") public CourseStaff postCourseStaff(@RequestParam String firstName, @RequestParam String lastName, @RequestParam String email, @RequestParam Long courseId) throws EntityNotFoundException This method creates a new CourseStaff.- Returns:
- the created CourseStaff
- Throws:
EntityNotFoundException
-
uploadCourseStaffCSV
@PreAuthorize("@CourseSecurity.hasInstructorPermissions(#root, #courseId)") @PostMapping(value="/upload/csv", consumes="multipart/form-data") public org.springframework.http.ResponseEntity<List<CourseStaff>> uploadCourseStaffCSV(@RequestParam Long courseId, @RequestParam("file") org.springframework.web.multipart.MultipartFile file) throws IOException, com.opencsv.exceptions.CsvException - Throws:
IOExceptioncom.opencsv.exceptions.CsvException
-
courseStaffForCourse
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("/course") public Iterable<CourseStaff> courseStaffForCourse(@RequestParam Long courseId) throws EntityNotFoundException This method returns a list of course staff for a given course.- Returns:
- a list of all courses.
- Throws:
EntityNotFoundException
-
joinCourseOnGitHub
@PreAuthorize("hasRole(\'ROLE_USER\')") @PutMapping("/joinCourse") public org.springframework.http.ResponseEntity<String> joinCourseOnGitHub(@RequestParam Long courseStaffId) throws NoSuchAlgorithmException, InvalidKeySpecException, com.fasterxml.jackson.core.JsonProcessingException - Throws:
NoSuchAlgorithmExceptionInvalidKeySpecExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
updateStaffMember
@PreAuthorize("@CourseSecurity.hasInstructorPermissions(#root, #courseId)") @PutMapping("") public CourseStaff updateStaffMember(@RequestParam Long courseId, @RequestParam Long id, @RequestParam String firstName, @RequestParam String lastName) throws EntityNotFoundException - Throws:
EntityNotFoundException
-
deleteStaffMember
@PreAuthorize("@CourseSecurity.hasInstructorPermissions(#root, #courseId)") @DeleteMapping("/delete") @Transactional public org.springframework.http.ResponseEntity<String> deleteStaffMember(@RequestParam Long id, @RequestParam Long courseId, @RequestParam(defaultValue="false") boolean removeFromOrg) throws EntityNotFoundException - Throws:
EntityNotFoundException
-