Interface UserApi


  • public interface UserApi
    Contains all api operations for handling users.
    • Method Detail

      • addUser

        User addUser​(AddUserRequest addUserRequest)
        Adds a new user. The username can contain only unicode printable characters and cannot contain leading and trailing spaces.
        Parameters:
        addUserRequest - the properties of the user to be added
        Returns:
        the newly added user
      • addUsers

        @SecurityAuditMethod(resultFormatter=com.collibra.audit.formatter.CollectionCountFormatter.class)
        List<User> addUsers​(List<AddUserRequest> addUserRequests)
        Adds new users. The username can contain only unicode printable characters and cannot contain leading and trailing spaces.
        Parameters:
        addUserRequests - the properties of users to be added
        Returns:
        the newly added users
      • getUser

        @SecurityAuditMethod(resultFormatter=ApiUserFormatter.class)
        User getUser​(UUID userId)
        Returns the user with the given id.
        Parameters:
        userId - the id of the user
        Returns:
        the found user
      • getUserByEmailAddress

        @SecurityAuditMethod(resultFormatter=ApiUserFormatter.class)
        User getUserByEmailAddress​(String emailAddress)
        Returns user with given email address.
        Parameters:
        emailAddress - email address of the user
        Returns:
        user with given email address
      • getUserByUsername

        @SecurityAuditMethod(resultFormatter=ApiUserFormatter.class)
        User getUserByUsername​(String username)
        Returns user with given username.
        Parameters:
        username - Username of the user
        Returns:
        user with given username
      • getCurrentUser

        @SecurityAuditMethod(includeInAudit=false)
        Optional<User> getCurrentUser()
        Returns the currently logged in user.
        Returns:
        The currently logged in user or empty Optional object if not logged in.
      • exists

        boolean exists​(UUID userId)
        Returns true if a user with given userId exists.
        Parameters:
        userId - the ID of the user being tested
        Returns:
        true if a user with given userId exists
      • changeUser

        @SecurityAuditMethod(resultFormatter=ApiUserFormatter.class)
        User changeUser​(ChangeUserRequest changeUserRequest)
        Change the user with the information present in the input. The username can contain only unicode printable characters and cannot contain leading and trailing spaces.
        Parameters:
        changeUserRequest - changes that need to be performed on the user
        Returns:
        the changed user
      • changeUserAvatar

        @SecurityAuditMethod(resultFormatter=ApiUserFormatter.class)
        User changeUserAvatar​(ChangeUserAvatarRequest changeUserAvatarRequest)
        Change the avatar for the given user.
        Parameters:
        changeUserAvatarRequest - the request containing all the necessary information for the change.
        Returns:
        the changed user.
      • removeAvatar

        void removeAvatar​(UUID userId)
        Remove the avatar of the given user.
        Parameters:
        userId - the user ID for whom the avatar will be removed
      • removeUser

        void removeUser​(UUID userId)
        Remove the user with the given ID.
        Parameters:
        userId - The ID of the user that will be removed.
      • setGroupsForUser

        @SecurityAuditMethod(resultFormatter=ApiUserFormatter.class)
        User setGroupsForUser​(SetUserGroupsForUserRequest setUserGroupsForUserRequest)
        Sets the list of user groups this user should belong to.

        If user belongs to any user groups that are not specified in this request then it will be removed from those groups after request is executed.

        Parameters:
        setUserGroupsForUserRequest - the list of user groups that this user should belong to
        Returns:
        the user
      • removeUserFromUserGroups

        void removeUserFromUserGroups​(RemoveUserFromUserGroupsRequest removeUserFromUserGroupsRequest)
        Remove user from given user groups.
        Parameters:
        removeUserFromUserGroupsRequest - the properties needed to remove the user from given user groups
      • addUserToUserGroups

        @SecurityAuditMethod(resultFormatter=com.collibra.audit.formatter.CollectionCountFormatter.class)
        List<UserGroup> addUserToUserGroups​(AddUserToUserGroupsRequest addUserToUserGroupsRequest)
        Adds user to given user groups.
        Parameters:
        addUserToUserGroupsRequest - the properties needed to add the user to given user groups
        Returns:
        the list of user groups the user has been assigned to
      • getUserRequiredLicenseType

        LicenseType getUserRequiredLicenseType​(UUID userId)
        Gets the required LicenseType for the given user.

        The required LicenseType is the maximum license type of any permission included in a global role or resource role of that user (or group of that user).

        Parameters:
        userId - the id of the user
        Returns:
        the required LicenseType