Class AdminController
- java.lang.Object
-
- cz.zcu.students.cacha.bp_server.controllers.AdminController
-
@RestController @RequestMapping("/admin") public class AdminController extends Object
Class represent rest controller which is responsible for administrator operations
-
-
Constructor Summary
Constructors Constructor Description AdminController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UserDetailVM
getUserDetail(Long userId)
Gets the details about given userList<UserVM>
getUsers()
Gets all users except adminsGenericResponse
removeInstitution(Long userId)
Removes user's managerial rights to his institutionGenericResponse
setBan(@Valid BooleanValVM booleanValVM, Long userId)
Changes if user is banned or not depending on given valueGenericResponse
setTranslator(@Valid BooleanValVM booleanValVM, Long userId)
Changes the value of user translator rightsGenericResponse
updateUserPassword(Long userId)
Generates new password for user and sends it to his mailGenericResponse
updateUserUsername(@Valid UsernameUpdateVM usernameUpdateVM, Long userId)
Updates username to given user
-
-
-
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 usernameuserId
- 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 valueuserId
- 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 valueuserId
- user id- Returns:
- message containing whether operation was processed
-
-