Package pro.taskana.user.rest
Class UserController
- java.lang.Object
-
- pro.taskana.user.rest.UserController
-
@RestController @EnableHypermediaSupport(type=HAL) public class UserController extends Object
Controller for all User related endpoints.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.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>getUser(String userId)This endpoint retrieves a User.org.springframework.http.ResponseEntity<UserRepresentationModel>updateUser(String userId, UserRepresentationModel repModel)This endpoint updates a User.
-
-
-
Method Detail
-
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.UserNotFoundExceptionThis 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 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.NotAuthorizedExceptionThis 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.NotAuthorizedExceptionThis 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.NotAuthorizedExceptionThis 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-admin
-
-