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 Details

    • getUser

      @GetMapping("/api/v1/users/{userId}") @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public org.springframework.http.ResponseEntity<UserRepresentationModel> getUser(@PathVariable("userId") 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 found
      pro.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 itself
      userIds - the ids of the requested Users
      currentUser - 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 empty
      pro.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 set
      pro.taskana.user.api.exceptions.UserAlreadyExistException - if a User with id } is already existing
      pro.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 update
      repModel - the User with the updated fields
      Returns:
      the updated User
      Throws:
      pro.taskana.common.api.exceptions.InvalidArgumentException - if the id has not been set
      pro.taskana.user.api.exceptions.UserNotFoundException - if a User with id is not existing in the database
      pro.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("userId") 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 found
      pro.taskana.common.api.exceptions.NotAuthorizedException - if the current user is no admin or business-admin
      pro.taskana.common.api.exceptions.InvalidArgumentException - if the id is null or empty