Class RosterStudentsController

java.lang.Object
edu.ucsb.cs.scaffold.controller.ApiController
edu.ucsb.cs.scaffold.controller.RosterStudentsController

@RequestMapping("/api/rosterstudents") @RestController public class RosterStudentsController extends ApiController
  • Constructor Details

    • RosterStudentsController

      public RosterStudentsController()
  • Method Details

    • postRosterStudent

      @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping("/post") public org.springframework.http.ResponseEntity<UpsertResponse> postRosterStudent(@RequestParam String studentId, @RequestParam String firstName, @RequestParam String lastName, @RequestParam String email, @RequestParam Long courseId, @RequestParam(required=false) String section) throws EntityNotFoundException
      This method creates a new RosterStudent. It is important to keep the code in this method consistent with the code for adding multiple roster students from a CSV
      Returns:
      the created RosterStudent
      Throws:
      EntityNotFoundException
    • rosterStudentForCourse

      @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("/course/{courseId}") public Iterable<RosterStudentDTO> rosterStudentForCourse(@PathVariable Long courseId) throws EntityNotFoundException
      This method returns a list of roster students for a given course.
      Returns:
      a list of all courses.
      Throws:
      EntityNotFoundException
    • upsertStudent

      public static UpsertResponse upsertStudent(RosterStudent student, Course course, RosterStatus rosterStatus)
    • getAssociatedRosterStudents

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/associatedRosterStudents") public Iterable<RosterStudent> getAssociatedRosterStudents()
    • updateRosterStudent

      @PreAuthorize("@CourseSecurity.hasRosterStudentManagementPermissions(#root, #id)") @PutMapping("/update") public RosterStudent updateRosterStudent(@RequestParam Long id, @RequestParam(required=false) String firstName, @RequestParam(required=false) String lastName, @RequestParam(required=false) String studentId, @RequestParam(required=false) String section) throws EntityNotFoundException
      Throws:
      EntityNotFoundException
    • restoreRosterStudent

      @PreAuthorize("@CourseSecurity.hasRosterStudentManagementPermissions(#root, #id)") @PutMapping("/restore") public RosterStudent restoreRosterStudent(@RequestParam Long id) throws EntityNotFoundException
      Throws:
      EntityNotFoundException
    • deleteRosterStudent

      @PreAuthorize("@CourseSecurity.hasRosterStudentManagementPermissions(#root, #id)") @DeleteMapping("/delete") @Transactional public org.springframework.http.ResponseEntity<String> deleteRosterStudent(@RequestParam Long id) throws EntityNotFoundException
      Throws:
      EntityNotFoundException