Package pro.taskana.user.rest
Class UserController
java.lang.Object
pro.taskana.user.rest.UserController
Controller for all User related endpoints.
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<UserRepresentationModel>createUser(UserRepresentationModel repModel) This endpoint creates a User.org.springframework.http.ResponseEntity<UserRepresentationModel>deleteUser(String userId) This endpoint deletes a User.org.springframework.http.ResponseEntity<UserRepresentationModel>This endpoint retrieves a User.org.springframework.http.ResponseEntity<UserCollectionRepresentationModel>This endpoint retrieves multiple Users.org.springframework.http.ResponseEntity<UserRepresentationModel>updateUser(String userId, UserRepresentationModel repModel) This endpoint updates a User.
-
Method Details
-
getUser
@GetMapping("/api/v1/users/{userId}") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<UserRepresentationModel> getUser(@PathVariable String userId) throws pro.taskana.user.api.exceptions.UserNotFoundException, pro.taskana.common.api.exceptions.InvalidArgumentException This endpoint retrieves a User.- Parameters:
userId- the id of the requested User- Returns:
- the requested User
- Throws:
pro.taskana.user.api.exceptions.UserNotFoundException- if the id has not been foundpro.taskana.common.api.exceptions.InvalidArgumentException- if the id is null or empty
-
getUsers
@GetMapping("/api/v1/users") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<UserCollectionRepresentationModel> getUsers(jakarta.servlet.http.HttpServletRequest request, @RequestParam(name="user-id",required=false) String[] userIds, @RequestParam(name="current-user",required=false) String currentUser) throws pro.taskana.common.api.exceptions.InvalidArgumentException, pro.taskana.user.api.exceptions.UserNotFoundException This endpoint retrieves multiple Users. If a userId can't be found in the database it will be ignored. If none of the given userIds is valid, the returned list will be empty. If currentUser is set, the current User from the context will be retrieved as well- Parameters:
request- the HttpServletRequest of the request itselfuserIds- the ids of the requested UserscurrentUser- Indicates whether to fetch the current user or not as well- Returns:
- the requested Users
- Throws:
pro.taskana.common.api.exceptions.InvalidArgumentException- if the userIds are null or emptypro.taskana.user.api.exceptions.UserNotFoundException- if the current User was not found
-
createUser
@PostMapping("/api/v1/users") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<UserRepresentationModel> createUser(@RequestBody UserRepresentationModel repModel) throws pro.taskana.common.api.exceptions.InvalidArgumentException, pro.taskana.user.api.exceptions.UserAlreadyExistException, pro.taskana.common.api.exceptions.NotAuthorizedException This endpoint creates a User.- Parameters:
repModel- the User which should be created- Returns:
- the inserted User
- Throws:
pro.taskana.common.api.exceptions.InvalidArgumentException- if the id has not been setpro.taskana.user.api.exceptions.UserAlreadyExistException- if a User with id } is already existingpro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is no admin or business-admin
-
updateUser
@PutMapping("/api/v1/users/{userId}") @Transactional(rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<UserRepresentationModel> updateUser(@PathVariable("userId") String userId, @RequestBody UserRepresentationModel repModel) throws pro.taskana.common.api.exceptions.InvalidArgumentException, pro.taskana.user.api.exceptions.UserNotFoundException, pro.taskana.common.api.exceptions.NotAuthorizedException This endpoint updates a User.- Parameters:
userId- the id of the User to updaterepModel- the User with the updated fields- Returns:
- the updated User
- Throws:
pro.taskana.common.api.exceptions.InvalidArgumentException- if the id has not been setpro.taskana.user.api.exceptions.UserNotFoundException- if a User with id is not existing in the databasepro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is no admin or business-admin
-
deleteUser
@DeleteMapping("/api/v1/users/{userId}") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<UserRepresentationModel> deleteUser(@PathVariable String userId) throws pro.taskana.user.api.exceptions.UserNotFoundException, pro.taskana.common.api.exceptions.NotAuthorizedException, pro.taskana.common.api.exceptions.InvalidArgumentException This endpoint deletes a User.- Parameters:
userId- the id of the User to delete- Returns:
- no content
- Throws:
pro.taskana.user.api.exceptions.UserNotFoundException- if the id has not been foundpro.taskana.common.api.exceptions.NotAuthorizedException- if the current user is no admin or business-adminpro.taskana.common.api.exceptions.InvalidArgumentException- if the id is null or empty
-