Class AdminController


  • @RestController
    @RequestMapping("/admin")
    public class AdminController
    extends Object
    Class represent rest controller which is responsible for administrator operations
    • Constructor Detail

      • AdminController

        public AdminController()
    • Method Detail

      • getUsers

        @GetMapping("/users")
        public List<UserVM> getUsers()
        Gets all users except admins
        Returns:
        all users except admins
      • getUserDetail

        @GetMapping("/users/{userId}")
        public UserDetailVM getUserDetail​(@PathVariable
                                          Long userId)
        Gets the details about given user
        Parameters:
        userId - user id
        Returns:
        details about user
      • updateUserUsername

        @PutMapping("/users/{userId}/updateUsername")
        public GenericResponse updateUserUsername​(@Valid @RequestBody
                                                  @Valid UsernameUpdateVM usernameUpdateVM,
                                                  @PathVariable
                                                  Long userId)
        Updates username to given user
        Parameters:
        usernameUpdateVM - new username
        userId - user id
        Returns:
        message containing whether operation was processed
      • updateUserPassword

        @PutMapping("/users/{userId}/updatePassword")
        public GenericResponse updateUserPassword​(@PathVariable
                                                  Long userId)
        Generates new password for user and sends it to his mail
        Parameters:
        userId - user id
        Returns:
        message containing whether operation was processed
      • setTranslator

        @PutMapping("/users/{userId}/updateTranslator")
        public GenericResponse setTranslator​(@Valid @RequestBody
                                             @Valid BooleanValVM booleanValVM,
                                             @PathVariable
                                             Long userId)
        Changes the value of user translator rights
        Parameters:
        booleanValVM - new user rights value
        userId - user id
        Returns:
        message containing whether operation was processed
      • removeInstitution

        @PutMapping("/users/{userId}/removeInstitution")
        public GenericResponse removeInstitution​(@PathVariable
                                                 Long userId)
        Removes user's managerial rights to his institution
        Parameters:
        userId - user id
        Returns:
        message containing whether operation was processed
      • setBan

        @PutMapping("/users/{userId}/updateBan")
        public GenericResponse setBan​(@Valid @RequestBody
                                      @Valid BooleanValVM booleanValVM,
                                      @PathVariable
                                      Long userId)
        Changes if user is banned or not depending on given value
        Parameters:
        booleanValVM - new ban value
        userId - user id
        Returns:
        message containing whether operation was processed