Class UserAdminRestController

java.lang.Object
se.bth.pulse.controller.UserAdminRestController

@RestController public class UserAdminRestController extends Object
This class is a rest controller that serves the user admin page.
  • Constructor Details

    • UserAdminRestController

      public UserAdminRestController(UserRepository userRepository)
  • Method Details

    • editUser

      @PostMapping("/api/admin/user/edit") public org.springframework.http.ResponseEntity editUser(Integer id, String firstname, String lastname, String email, String phonenr, Boolean credentialsExpired)
      Used to update the users profile. The user is retrieved from the user repository using the id. The user firstname, lastname, email, phonenr and credentialsExpired are updated. To make the user change password the credentialsExpired is set to true.
      Parameters:
      id - - the id of the user to be edited
      firstname - - the new firstname of the user
      lastname - - the new lastname of the user
      email - - the new email of the user
      phonenr - - the new phonenr of the user
      credentialsExpired - - the new credentialsExpired of the user
      Returns:
      ResponseEntity - the response entity containing a success message if the user
    • disableUser

      @PostMapping("/api/admin/user/disable/{id}") public org.springframework.http.ResponseEntity disableUser(@PathVariable("id") Integer id)
      Used to disable a user permanently.
      Parameters:
      id - - the id of the user to be enabled
      Returns:
      ResponseEntity - the response entity containing a success message if the user