Class UserManager


  • public class UserManager
    extends AbstractAPIManager
    Class to manage users using the Obsidian public embedded API. This class can only manage native Obsidian users and does not support LDAP or other authentication methods. See AbstractAPIManager for details on how transactions are managed within all requests.

    Example:

        UserListing listing = new UserManager().listUsers();
        System.out.println("Users: " + listing);
     
    Since:
    3.0
    See Also:
    Embedded API Wiki, REST API Wiki
    • Constructor Detail

      • UserManager

        public UserManager()
    • Method Detail

      • listUsers

        public UserListing listUsers()
                              throws java.lang.Exception
        Lists configured users.
        Returns:
        the full UserListing
        Throws:
        java.lang.Exception - Any type of unexpected exception.
        Since:
        3.0
      • getUser

        public User getUser​(long userId)
                     throws MissingEntityException,
                            java.lang.Exception
        Loads details on an existing user.
        Parameters:
        userId - ID of the user to load
        Returns:
        the configured User
        Throws:
        MissingEntityException - If the user with the requested ID does not exist.
        java.lang.Exception - Any other type of unexpected exception.
        Since:
        3.0
      • addUser

        public User addUser​(UserCreationRequest request,
                            java.lang.String auditUser)
                     throws ValidationException,
                            java.lang.Exception
        Creates a new user with the supplied configuration.
        Parameters:
        request - the user to save
        auditUser - Optional user that is marked in audit columns. Defaults to "embeddedAPI".
        Returns:
        the updated User
        Throws:
        ValidationException - A validation error which prevents the action from succeeding.
        java.lang.Exception - Any other type of unexpected exception.
        Since:
        3.0
      • updateUser

        public User updateUser​(long userId,
                               UserUpdateRequest request,
                               java.lang.String auditUser)
                        throws ValidationException,
                               MissingEntityException,
                               java.lang.Exception
        Updates the requested user with the supplied configuration.
        Parameters:
        userId - ID of the user to update
        request - the user to save
        auditUser - Optional user that is marked in audit columns. Defaults to "embeddedAPI".
        Returns:
        the updated User
        Throws:
        ValidationException - A validation error which prevents the action from succeeding.
        MissingEntityException - If the user with the requested ID does not exist.
        java.lang.Exception - Any other type of unexpected exception.
        Since:
        3.0
      • deleteUser

        public User deleteUser​(long userId,
                               java.lang.String auditUser)
                        throws ValidationException,
                               MissingEntityException,
                               java.lang.Exception
        Deletes the requested user.
        Parameters:
        userId - ID of the user to delete
        auditUser - Optional user that is marked in audit columns. Defaults to "embeddedAPI".
        Returns:
        the deleted User
        Throws:
        ValidationException - A validation error which prevents the action from succeeding.
        MissingEntityException - If the user with the requested ID does not exist.
        java.lang.Exception - Any other type of unexpected exception.
        Since:
        3.0
      • resetMfa

        public MfaUserListing resetMfa​(ResetMfaRequest request,
                                       java.lang.String auditUser)
                                throws ValidationException,
                                       java.lang.Exception
        Resets the requested user's multi-factor authentication state so that they may perform MFA setup.
        Parameters:
        request - containing user names (login user name) to reset. This may include users that are not yet known and have not attempted a login in the past.
        auditUser - Optional user that is marked in audit columns. Defaults to "embeddedAPI".
        Returns:
        listing of the updated users
        Throws:
        ValidationException - A validation error which prevents the action from succeeding.
        java.lang.Exception - Any other type of unexpected exception.
        Since:
        5.0
      • listMfaUsers

        public MfaUserListing listMfaUsers()
                                    throws java.lang.Exception
        Returns all known users which may have MFA resets applied. Exists to facilitate use of resetMfa(ResetMfaRequest, String) in cases where Obsidian's native authentication is not used. When native authentication is used, this will be a listing of all users. When other authentication methods are used, this will include users who have have MFA resets applied and those who have attempted login after MFA was enabled.
        Returns:
        listing of known MFA users
        Throws:
        java.lang.Exception - Any type of unexpected exception.
        Since:
        5.0