Class UserManagerImpl

    • Method Detail

      • getAuthorizable

        @Nullable
        public <T extends Authorizable> T getAuthorizable​(@NotNull
                                                          @NotNull String id,
                                                          @NotNull
                                                          @NotNull Class<T> authorizableClass)
                                                   throws RepositoryException
        Description copied from interface: UserManager
        Get the Authorizable of a specific type by its id.
        Specified by:
        getAuthorizable in interface UserManager
        Type Parameters:
        T - the required Authorizable type.
        Parameters:
        id - the user or group id.
        authorizableClass - the class of the type of Authorizable required; must not be null.
        Returns:
        Authorizable or null, if not present.
        Throws:
        AuthorizableTypeException - If an authorizable exists but is not of the requested type.
        RepositoryException - If an error occurs
      • findAuthorizables

        @NotNull
        public @NotNull Iterator<Authorizable> findAuthorizables​(@NotNull
                                                                 @NotNull String relPath,
                                                                 @Nullable
                                                                 @Nullable String value)
                                                          throws RepositoryException
        Description copied from interface: UserManager
        Returns all Authorizables that have a property with the given relative path (or name) that matches the specified value.

        If a relative path with more than one segment is specified only properties exactly matching that patch will be returned. If, however, a name is specified all properties that may be retrieved using Authorizable.getProperty(String) will be searched for a match.

        Specified by:
        findAuthorizables in interface UserManager
        Parameters:
        relPath - A relative property path or name.
        value - A string value to match.
        Returns:
        All Authorizables that have a property with the given name exactly matching the given value.
        Throws:
        RepositoryException - If an error occurs.
        See Also:
        Authorizable.getProperty(String)
      • createUser

        @NotNull
        public @NotNull User createUser​(@NotNull
                                        @NotNull String userID,
                                        @Nullable
                                        @Nullable String password,
                                        @NotNull
                                        @NotNull Principal principal,
                                        @Nullable
                                        @Nullable String intermediatePath)
                                 throws RepositoryException
        Description copied from interface: UserManager
        Creates a user for the given parameters. If the implementation is not able to deal with the intermediatePath that parameter should be ignored. Except for the intermediatePath and password, neither of the specified parameters can be null.

        The given password may be null however the behavior of such users depend on the implementation (usually those users cannot be used for authentication but only for impersonation). Consider using UserManager.createSystemUser(String, String) rather than creating a user with a null password with this method.

        Specified by:
        createUser in interface UserManager
        Parameters:
        userID - The ID of the new user.
        password - The initial password of the new user.
        principal - The principal of the new user.
        intermediatePath - An optional intermediate path used to create the new user. If the intermediate path is null an internal, implementation specific structure will be used.
        Returns:
        The new User.
        Throws:
        AuthorizableExistsException - in case the given userID is already in use or another Authorizable with the same principal name exists.
        RepositoryException - If the current Session is not allowed to create users or some another error occurs.
        See Also:
        UserManager.createSystemUser(String, String)
      • createSystemUser

        @NotNull
        public @NotNull User createSystemUser​(@NotNull
                                              @NotNull String userID,
                                              @Nullable
                                              @Nullable String intermediatePath)
                                       throws RepositoryException
        Description copied from interface: UserManager
        Create a new system user for the specified userID. The new authorizable is required to have the following characteristics:
        • User.isSystemUser() returns true.
        • The system user doesn't have a password set and doesn't allow change the password.
        • The principal name is generated by the system; it may be the same as userID.
        • A given implementation may choose to keep system users in a dedicated location and thus may impose restrictions on the intermediatePath.
        Specified by:
        createSystemUser in interface UserManager
        Parameters:
        userID - A valid userID.
        intermediatePath - An optional intermediate path to create the new system user. The implemenation may decide to reject intermediate paths if they violate an implementation specific requirement with respect to the location where systems users are being held. If the intermediate path is null an internal implementation specific structure will be used.
        Returns:
        The new system user.
        Throws:
        AuthorizableExistsException - if an Authorizable with this id already exists.
        RepositoryException - If another error occurs.
      • createGroup

        @NotNull
        public @NotNull Group createGroup​(@NotNull
                                          @NotNull Principal principal)
                                   throws RepositoryException
        Description copied from interface: UserManager
        Creates a new Group that is based on the given principal. Note that the group's ID is implementation specific. The implementation may take the principal name as ID hint but must in any case assert that it is unique among the IDs known to this manager.
        Specified by:
        createGroup in interface UserManager
        Parameters:
        principal - A non-null Principal
        Returns:
        The new Group.
        Throws:
        AuthorizableExistsException - in case the given principal is already in use with another Authorizable.
        RepositoryException - If another error occurs.
      • createGroup

        @NotNull
        public @NotNull Group createGroup​(@NotNull
                                          @NotNull String groupID,
                                          @NotNull
                                          @NotNull Principal principal,
                                          @Nullable
                                          @Nullable String intermediatePath)
                                   throws RepositoryException
        Description copied from interface: UserManager
        Creates a new Group that is based on the given id, principal and the specified intermediatePath hint. If the implementation is not able to deal with the intermediatePath this parameter should be ignored.
        Specified by:
        createGroup in interface UserManager
        Parameters:
        groupID - The ID of the new group.
        principal - The principal of the new group.
        intermediatePath - An optional intermediate path used to create the new group. If the intermediate path is null an internal, implementation specific structure will be used.
        Returns:
        The new Group.
        Throws:
        AuthorizableExistsException - in case the given principal is already in use with another Authorizable.
        RepositoryException - If another error occurs.
      • isAutoSave

        public boolean isAutoSave()
        Always returns false. Any modifications made to this user manager instance require a subsequent call to Session.save() in order to have the changes persisted.
        Specified by:
        isAutoSave in interface UserManager
        Returns:
        true if changes are automatically persisted; false if changes made through this API (including method calls on Authorizable and subclasses are only transient and must be persisted using Session.save().
        See Also:
        UserManager.autoSave(boolean)
      • autoSave

        public void autoSave​(boolean enable)
                      throws RepositoryException
        Changing the auto-save behavior is not supported by this implementation and this method always throws UnsupportedRepositoryOperationException
        Specified by:
        autoSave in interface UserManager
        Parameters:
        enable - If true changes made through this API will be automatically saved; otherwise an explicit call to Session.save() is required in order to persist changes.
        Throws:
        UnsupportedRepositoryOperationException - If the implementation does not allow to change the auto save behavior.
        RepositoryException - If some other error occurs.