Class CurrentUserController

java.lang.Object
edu.ucsb.cs156.dining.controllers.ApiController
edu.ucsb.cs156.dining.controllers.CurrentUserController

@RequestMapping("/api/currentuser") @RestController public class CurrentUserController extends ApiController
This is a REST controller for CurrentUser
  • Constructor Details

    • CurrentUserController

      public CurrentUserController()
  • Method Details

    • postUser

      @PreAuthorize("hasRole(\'ROLE_USER\')") @PostMapping("/updateAlias") public CurrentUser postUser(@RequestParam String alias, @RequestParam long modValue)
      This method creates a new user. Accessible only to user with the role "ROLE_USER".
      Parameters:
      alias - alias of the user
      Returns:
      the save user
    • updateModValue

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("/updateModValue") public CurrentUser updateModValue(@RequestParam String alias, @RequestBody @Valid @Valid CurrentUser incoming)
      Update a single users. Accessible only to users with the role "ROLE_ADMIN".
      Parameters:
      alias - alias moderation value of the users
      incoming - the new users contents
      Returns:
      the updated users object