Class UserController


  • @RestController
    @EnableHypermediaSupport(type=HAL)
    public class UserController
    extends Object
    Controller for all User related endpoints.
    • 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.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​(@RequestParam(name="user-id")
                                                                                                   String[] userIds)
                                                                                            throws pro.taskana.common.api.exceptions.InvalidArgumentException
        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.
        Parameters:
        userIds - the ids of the requested Users
        Returns:
        the requested Users
        Throws:
        pro.taskana.common.api.exceptions.InvalidArgumentException - if the userIds are null or empty
      • 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
                                                                                           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