Class UCSBOrganizationsController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBOrganizationsController

@RequestMapping("/api/ucsborganizations") @RestController public class UCSBOrganizationsController extends ApiController
  • Constructor Details

    • UCSBOrganizationsController

      public UCSBOrganizationsController()
  • Method Details

    • allOrganizations

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganizations> allOrganizations()
      List all UCSB Orgs
      Returns:
      an iterable of UCSBOrganizations
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganizations getById(@RequestParam String orgCode)
      Get a single org by id
      Parameters:
      orgCode - the id of the date
      Returns:
      a UCSBOrg
    • updateOrganizations

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganizations updateOrganizations(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrganizations incoming)
      Update a single org. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      orgCode - code of the org
      incoming - the new org contents
      Returns:
      the updated org object
    • postOrganization

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganizations postOrganization(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive)
    • deleteOrganizations

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganizations(@RequestParam String orgCode)