Class DirectoryManagerGeneric
- All Implemented Interfaces:
DirectoryManager
- Direct Known Subclasses:
RecoveryModeAwareDirectoryManager
-
Constructor Summary
ConstructorDescriptionDirectoryManagerGeneric
(DirectoryDao directoryDao, ApplicationDAO applicationDAO, MultiEventPublisher eventPublisher, PermissionManager permissionManager, DirectoryInstanceLoader directoryInstanceLoader, DirectorySynchroniser directorySynchroniser, DirectoryPollerManager directoryPollerManager, com.atlassian.beehive.ClusterLockService lockService, SynchronisationStatusManager synchronisationStatusManager, BeforeGroupRemoval beforeGroupRemoval, Optional<NestedGroupsCacheProvider> nestedGroupsCacheProvider, LDAPPropertiesHelper ldapPropertiesHelper, LdapConnectionPropertiesDiffResultMapper ldapConnectionPropertiesDiffResultMapper) -
Method Summary
Modifier and TypeMethodDescriptionaddAllGroups
(long directoryId, Collection<GroupTemplate> groups, boolean overwrite) Will add a collection of Group to the directory specified by the passed indirectoryId
param.addAllUsers
(long directoryId, Collection<UserTemplateWithCredentialAndAttributes> users, boolean overwrite) Will add a collection of users to the directory specified by the passed indirectoryId
param.addAllUsersToGroup
(long directoryId, Collection<String> userNames, String groupName) A bulk version ofDirectoryManager.addUserToGroup(long, String, String)
.addDirectory
(Directory directory) Adds the given directory.addGroup
(long directoryId, GroupTemplate group) Adds a Group to the directory specified by the passed indirectoryId
.void
addGroupToGroup
(long directoryId, String childGroup, String parentGroup) Adds an existing child group as direct member of an existing parent group in the directory specified by the passed indirectoryId
.addUser
(long directoryId, UserTemplate user, PasswordCredential credential) Adds aUser
to the directory specified by the passed indirectoryId
.addUser
(long directoryId, UserTemplateWithAttributes user, PasswordCredential credential) Adds aUserWithAttributes
to the directory specified by the passed indirectoryId
.void
addUserToGroup
(long directoryId, String username, String groupName) Adds an existing user as a direct member of an existing group in the directory specified by the passed indirectoryId
.authenticateUser
(long directoryId, String username, PasswordCredential passwordCredential) countDirectMembersOfGroup
(long directoryId, String groupName, int querySizeHint) Count the direct members of a group in the provided directory with an upper bound.void
expireAllPasswords
(long directoryId) Sets theUserConstants.REQUIRES_PASSWORD_CHANGE
attribute to true for all users in the directoryfilterNestedUserMembersOfGroups
(long directoryId, Set<String> userNames, Set<String> groupNames) Returns names of users who are (nested) members of any of the specified groups.Returns a List of all directories in the system.findAuthorisedApplications
(long directoryId, List<String> groupNames) Finds all applications that a user from a given directory belonging to the specified groups can authenticate to.findDirectoryById
(long directoryId) Returns a Directory based on the passed indirectoryId
.findDirectoryByName
(String name) Finds a directory given the suppliedname
.findGroupByName
(long directoryId, String groupName) Returns the group matching the supplied groupName in the directory specified by the passed indirectoryId
..findGroupWithAttributesByName
(long directoryId, String groupName) Returns the group with all attributes matching the supplied groupName in the directory specified by the passed indirectoryId
..findRemoteUserByName
(Long directoryId, String username) Returns the user matching the supplied username in the authoritative remote directory specified by the passed indirectoryId
findUserByExternalId
(long directoryId, String externalId) Returns the user matching the supplied external ID in the directory specified by the passed indirectoryId
.findUserByName
(long directoryId, String username) Returns the user matching the supplied username in the directory specified by the passed indirectoryId
..findUserWithAttributesByExternalId
(long directoryId, String externalId) Returns the user (with attributes) matching the supplied external ID in the directory specified by the passed indirectoryId
.findUserWithAttributesByName
(long directoryId, String username) Returns the user with all attributes matching the supplied username in the directory specified by the passed indirectoryId
..getDirectorySynchronisationInformation
(long directoryId) Retrieves the sync info for the directory - last sync start time & duration, current sync start time (if directory is currently synchronising)getSynchronisationMode
(long directoryId) Returns the preferred synchronisation mode defined for the directory ifsynchronisable
, elsenull
getUserAvatarByName
(long directoryId, String username, int sizeHint) Return an avatar, if available, for the named user in the specified directory.boolean
isGroupDirectGroupMember
(long directoryId, String childGroup, String parentGroup) Returnstrue
if the childGroup is a direct member of the parentGroup in the directory specified by the passed indirectoryId
.boolean
isGroupNestedGroupMember
(long directoryId, String childGroupName, String parentGroupName) Returnstrue
if the childGroup is a direct or indirect (nested) member of the parentGroup in the directory specified by the passed indirectoryId
.boolean
isInternalUserStatusSupported
(long directoryId) Check if internal User status is supported by the directoryboolean
isSynchronisable
(long directoryId) Returns true if the underlying directory implementation supports manual synchronisation of the directory's local cache.boolean
isSynchronising
(long directoryId) Returns true if the given Directory is currently synchronising.boolean
isUserDirectGroupMember
(long directoryId, String username, String groupName) Returnstrue
if the user is a direct member of the group in the directory specified by the passed indirectoryId
.boolean
isUserNestedGroupMember
(long directoryId, String username, String groupName) Returnstrue
if the user is a direct or indirect (nested) member of the group in the directory specified by the passed indirectoryId
.boolean
isUserNestedGroupMember
(long directoryId, String username, Set<String> groupNames) Returnstrue
if the user is a direct or indirect (nested) member of any of the specified groups in the directory specified by the passed indirectoryId
.void
removeDirectory
(Directory directory) Removes a given directory and all its associated entities and mappings.void
removeGroup
(long directoryId, String groupName) Removes a group matching the supplied groupName in the directory specified by the passed indirectoryId
.void
removeGroupAttributes
(long directoryId, String groupName, String attributeName) Removes a group's attribute values in the directory specified by the passed indirectoryId
.void
removeGroupFromGroup
(long directoryId, String childGroup, String parentGroup) Removes an existing child group from being a direct member of an existing parent group in the directory specified by the passed indirectoryId
.void
removeUser
(long directoryId, String username) Removes a user matching the supplied username in the directory specified by the passed indirectoryId
.void
removeUserAttributes
(long directoryId, String username, String attributeName) Removes a user's attribute values in the directory specified by the passed indirectoryId
.void
removeUserFromGroup
(long directoryId, String username, String groupName) Removes an existing user from being a direct member of an existing group in the directory specified by the passed indirectoryId
.renameGroup
(long directoryId, String oldGroupname, String newGroupname) Renames a group in the directory specified by the passed indirectoryId
.renameUser
(long directoryId, String oldUsername, String newUsername) Renames a user in the directory specified by the passed indirectoryId
.<T> List<T>
searchDirectGroupRelationships
(long directoryId, MembershipQuery<T> query) Searches for direct group relationships in the directory specified by the passed indirectoryId
.searchDirectGroupRelationshipsGroupedByName
(long directoryId, MembershipQuery<T> query) Searches for direct group relationships in the directory specified by the passed indirectoryId
.searchDirectories
(EntityQuery<Directory> query) Returns a List of Directories matching the search query.<T> List<T>
searchGroups
(long directoryId, EntityQuery<T> query) Returns a list of groups matching the given query in the directory specified by the passed indirectoryId
.<T> List<T>
searchNestedGroupRelationships
(long directoryId, MembershipQuery<T> query) Searches for direct and indirect (nested) group relationships in the directory specified by the passed indirectoryId
.<T> List<T>
searchUsers
(long directoryId, EntityQuery<T> query) Returns a list of users matching the given query in the directory specified by the passed indirectoryId
.setUserStateInternally
(long directoryId, String username, boolean userActiveInternally) Set the user's active status in the specified remote directory.void
Adds or updates a group's attributes with the new Map of attribute values in the directory specified by the passed indirectoryId
.void
Adds or updates a user's attributes with the new Map of attribute values in the directory specified by the passed indirectoryId
.boolean
supportsExpireAllPasswords
(long directoryId) Returns true if the underlying directory implementation supports expiring passwordsboolean
supportsNestedGroups
(long directoryId) Returns true if the underlying directory implementation supports nested groups.void
synchroniseCache
(long directoryId, SynchronisationMode mode) Requests that this directory should update its cache by synchronising with the remote User data.void
synchroniseCache
(long directoryId, SynchronisationMode mode, boolean runInBackground) Requests that this directory should update its cache by synchronising with the remote User data.updateDirectory
(Directory directory) Updates the passed in directory.updateGroup
(long directoryId, GroupTemplate group) Updates a group with the supplied template and returns the updated group retrieved from the directory specified by the passed indirectoryId
.updateUser
(long directoryId, UserTemplate user) Updates a user with the supplied template and returns the updated user retrieved from the directory specified by the passed indirectoryId
.void
updateUserCredential
(long directoryId, String username, PasswordCredential credential) This will update the user's credential in the given directory specified by the passed indirectoryId
.updateUserFromRemoteDirectory
(User remoteUser) Updates the user details for the specified user based on the details in the remote directory.userAuthenticated
(long directoryId, String username)
-
Constructor Details
-
DirectoryManagerGeneric
public DirectoryManagerGeneric(DirectoryDao directoryDao, ApplicationDAO applicationDAO, MultiEventPublisher eventPublisher, PermissionManager permissionManager, DirectoryInstanceLoader directoryInstanceLoader, DirectorySynchroniser directorySynchroniser, DirectoryPollerManager directoryPollerManager, com.atlassian.beehive.ClusterLockService lockService, SynchronisationStatusManager synchronisationStatusManager, BeforeGroupRemoval beforeGroupRemoval, Optional<NestedGroupsCacheProvider> nestedGroupsCacheProvider, LDAPPropertiesHelper ldapPropertiesHelper, LdapConnectionPropertiesDiffResultMapper ldapConnectionPropertiesDiffResultMapper)
-
-
Method Details
-
addDirectory
Description copied from interface:DirectoryManager
Adds the given directory.- Specified by:
addDirectory
in interfaceDirectoryManager
- Parameters:
directory
- the Directory to add- Returns:
- the added Directory
- Throws:
DirectoryInstantiationException
- if there was an error instantiating the directory
-
findDirectoryById
Description copied from interface:DirectoryManager
Returns a Directory based on the passed indirectoryId
.- Specified by:
findDirectoryById
in interfaceDirectoryManager
- Parameters:
directoryId
- the id of the directory to find- Returns:
- the directory
- Throws:
DirectoryNotFoundException
- is thrown if the Directory cannot be found.
-
findAllDirectories
Description copied from interface:DirectoryManager
Returns a List of all directories in the system.- Specified by:
findAllDirectories
in interfaceDirectoryManager
- Returns:
- List of all Directories.
-
searchDirectories
Description copied from interface:DirectoryManager
Returns a List of Directories matching the search query.- Specified by:
searchDirectories
in interfaceDirectoryManager
- Parameters:
query
- the context to search on- Returns:
- a List of directories, or an Empty List of none are found
-
findDirectoryByName
Description copied from interface:DirectoryManager
Finds a directory given the suppliedname
.- Specified by:
findDirectoryByName
in interfaceDirectoryManager
- Parameters:
name
- the name of the directory- Returns:
- the directory with the given
name
- Throws:
DirectoryNotFoundException
- if no Directory is found
-
updateDirectory
Description copied from interface:DirectoryManager
Updates the passed in directory.- Specified by:
updateDirectory
in interfaceDirectoryManager
- Parameters:
directory
- the directory with updated attributes- Returns:
- the updated directory
- Throws:
DirectoryNotFoundException
- if no Directory is found
-
removeDirectory
public void removeDirectory(Directory directory) throws DirectoryNotFoundException, DirectoryCurrentlySynchronisingException Description copied from interface:DirectoryManager
Removes a given directory and all its associated entities and mappings.- Specified by:
removeDirectory
in interfaceDirectoryManager
- Parameters:
directory
- the directory to remove- Throws:
DirectoryNotFoundException
- if the directory cannot be foundDirectoryCurrentlySynchronisingException
- if the directory is currently synchronising
-
supportsNestedGroups
public boolean supportsNestedGroups(long directoryId) throws DirectoryInstantiationException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns true if the underlying directory implementation supports nested groups.- Specified by:
supportsNestedGroups
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of directory.- Returns:
- true if the directory supports nested groups
- Throws:
DirectoryInstantiationException
- if there was an error instantiating the directoryDirectoryNotFoundException
- if the directory could not be found.
-
isSynchronisable
public boolean isSynchronisable(long directoryId) throws DirectoryInstantiationException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns true if the underlying directory implementation supports manual synchronisation of the directory's local cache.That is if we keep a local cache that is periodically updated from the remote server.
If a directory is synchronisable (i.e.
isSynchronisable
returnstrue
, it is safe to cast the directory with the given ID into aSynchronisableDirectory
.- Specified by:
isSynchronisable
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of directory.- Returns:
- true if the directory supports synchronisation
- Throws:
DirectoryInstantiationException
- if there was an error instantiating the directoryDirectoryNotFoundException
- if the directory could not be found.
-
getSynchronisationMode
public SynchronisationMode getSynchronisationMode(long directoryId) throws DirectoryInstantiationException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns the preferred synchronisation mode defined for the directory ifsynchronisable
, elsenull
- Specified by:
getSynchronisationMode
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory- Returns:
- the preferred
SynchronisationMode
for a synchronisable directory,null
otherwise. - Throws:
DirectoryInstantiationException
DirectoryNotFoundException
-
synchroniseCache
public void synchroniseCache(long directoryId, SynchronisationMode mode) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Requests that this directory should update its cache by synchronising with the remote User data. The synchronisation will occur asynchronously, i.e. this method returns immediately and the synchronization continues in the background.If a synchronisation is currently in progress when this method is called, then this method does nothing.
- Specified by:
synchroniseCache
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of directory.mode
- the mode of the synchronisation- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory could not be found.
-
synchroniseCache
public void synchroniseCache(long directoryId, SynchronisationMode mode, boolean runInBackground) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Requests that this directory should update its cache by synchronising with the remote User data.If a synchronisation is currently in progress when this method is called, then this method does nothing if runInBackGround is true, otherwise it will throw OperationFailedException.
- Specified by:
synchroniseCache
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of directory.mode
- the mode of the synchronisationrunInBackground
- If True the synchronise will happen asynchronously.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory could not be found.
-
isSynchronising
public boolean isSynchronising(long directoryId) throws DirectoryInstantiationException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns true if the given Directory is currently synchronising. This method should only be used to give an indication regarding the synchronisation state in the UI and should not be used to control whether or not to start another synchronisation.- Specified by:
isSynchronising
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of directory.- Returns:
- true if the given Directory is currently synchronising, otherwise false.
- Throws:
DirectoryInstantiationException
- if there was an error instantiating the directoryDirectoryNotFoundException
- if the directory could not be found
-
getDirectorySynchronisationInformation
public DirectorySynchronisationInformation getDirectorySynchronisationInformation(long directoryId) throws DirectoryInstantiationException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Retrieves the sync info for the directory - last sync start time & duration, current sync start time (if directory is currently synchronising)- Specified by:
getDirectorySynchronisationInformation
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of directory- Returns:
- a DirectorySynchronisationInformation object that contains the synchronisation information for the directory. null if the RemoteDirectory is not an instance of SynchronisableDirectory
- Throws:
DirectoryInstantiationException
- if there was an error instantiating the directoryDirectoryNotFoundException
- if the directory could not be found.
-
authenticateUser
public User authenticateUser(long directoryId, String username, PasswordCredential passwordCredential) throws OperationFailedException, InactiveAccountException, InvalidAuthenticationException, ExpiredCredentialException, DirectoryNotFoundException, UserNotFoundException - Specified by:
authenticateUser
in interfaceDirectoryManager
- Parameters:
directoryId
- the id of the directory to authenticate againstusername
- the username to use for authenticationpasswordCredential
- the credential to use for authentication- Returns:
- will return the user if authentication is successful
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.InactiveAccountException
- if the user account is inactiveInvalidAuthenticationException
- if authentication with the provided credentials failedExpiredCredentialException
- if the credentials of the user have expired.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory
-
userAuthenticated
public User userAuthenticated(long directoryId, String username) throws OperationFailedException, DirectoryNotFoundException, UserNotFoundException, InactiveAccountException - Specified by:
userAuthenticated
in interfaceDirectoryManager
- Throws:
OperationFailedException
DirectoryNotFoundException
UserNotFoundException
InactiveAccountException
-
findUserByName
public User findUserByName(long directoryId, String username) throws OperationFailedException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Returns the user matching the supplied username in the directory specified by the passed indirectoryId
..- Specified by:
findUserByName
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.username
- username of the user to retrieve.- Returns:
- user matching the supplied username.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory- See Also:
-
findUserWithAttributesByName
public UserWithAttributes findUserWithAttributesByName(long directoryId, String username) throws OperationFailedException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Returns the user with all attributes matching the supplied username in the directory specified by the passed indirectoryId
..- Specified by:
findUserWithAttributesByName
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.username
- username of the user to retrieve.- Returns:
- user (with all attributes) matching the supplied username.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory- See Also:
-
searchUsers
public <T> List<T> searchUsers(long directoryId, EntityQuery<T> query) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns a list of users matching the given query in the directory specified by the passed indirectoryId
.The users will be returned in a stable order including across pagination boundaries (excluding modification).
- Specified by:
searchUsers
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.query
- query to exectute.- Returns:
- List of
User
entities orString
usernames matching the query criteria. - Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
addUser
public User addUser(long directoryId, UserTemplate user, PasswordCredential credential) throws InvalidCredentialException, InvalidUserException, OperationFailedException, DirectoryPermissionException, DirectoryNotFoundException, UserAlreadyExistsException Description copied from interface:DirectoryManager
Adds aUser
to the directory specified by the passed indirectoryId
.- Specified by:
addUser
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to add the user to.user
- aUserTemplate
of the user to be added.credential
- the password credential of the user (unencrypted).- Returns:
- the added user returned from the directory.
- Throws:
InvalidCredentialException
- if the user's credential does not meet the validation requirements for the given directory.InvalidUserException
- if the user template does not have the required properties populated.OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.CREATE_USER
.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserAlreadyExistsException
- if the user already exists in the given directory
-
addUser
public UserWithAttributes addUser(long directoryId, UserTemplateWithAttributes user, PasswordCredential credential) throws InvalidCredentialException, InvalidUserException, OperationFailedException, DirectoryPermissionException, DirectoryNotFoundException, UserAlreadyExistsException Description copied from interface:DirectoryManager
Adds aUserWithAttributes
to the directory specified by the passed indirectoryId
.- Specified by:
addUser
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to add the user to.user
- aUserTemplateWithAttributes
of the user to be added.credential
- the password credential of the user (unencrypted).- Returns:
- the added user returned from the directory.
- Throws:
InvalidCredentialException
- if the user's credential does not meet the validation requirements for the given directory.InvalidUserException
- if the user template does not have the required properties populated.OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.CREATE_USER
.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserAlreadyExistsException
- if the user already exists in the given directory
-
updateUser
public User updateUser(long directoryId, UserTemplate user) throws OperationFailedException, DirectoryPermissionException, InvalidUserException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Updates a user with the supplied template and returns the updated user retrieved from the directory specified by the passed indirectoryId
.This method cannot be used to rename the user, update the user's credentials or update the user's custom attributes.
- Specified by:
updateUser
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the user.user
- template of the user to update.- Returns:
- the updated user returned from the directory.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_USER
.InvalidUserException
- the user template does not have the required properties populated.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory- See Also:
-
setUserStateInternally
public User setUserStateInternally(long directoryId, String username, boolean userActiveInternally) throws OperationFailedException, InvalidUserException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Set the user's active status in the specified remote directory. The specified directory must be an instance ofDbCachingRemoteDirectory
for this operation to succeed.- Specified by:
setUserStateInternally
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the user.username
- username of the user to be activated/deactivated.userActiveInternally
- Whether to activate/deactivate the user- Returns:
- the updated user returned from the directory.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation or the specified directory is not an instance of DbCachingRemoteDirectoryInvalidUserException
- the user template does not have the required properties populated.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory
-
renameUser
public User renameUser(long directoryId, String oldUsername, String newUsername) throws OperationFailedException, DirectoryPermissionException, InvalidUserException, DirectoryNotFoundException, UserNotFoundException, UserAlreadyExistsException Description copied from interface:DirectoryManager
Renames a user in the directory specified by the passed indirectoryId
.- Specified by:
renameUser
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the user.oldUsername
- current username of the user.newUsername
- desired username of the user.- Returns:
- updated user returned from the directory.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_USER
.InvalidUserException
- if the new username does not meet the username requirements of the directoryDirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directoryUserAlreadyExistsException
- if thenewUsername
user already exists in the given directory
-
storeUserAttributes
public void storeUserAttributes(long directoryId, String username, Map<String, Set<String>> attributes) throws OperationFailedException, DirectoryPermissionException, DirectoryNotFoundException, UserNotFoundExceptionDescription copied from interface:DirectoryManager
Adds or updates a user's attributes with the new Map of attribute values in the directory specified by the passed indirectoryId
.The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute matches the key of an existing attribute on the user.
This method does not update primary field attributes like firstName, lastName, etc.
- Specified by:
storeUserAttributes
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the user.username
- username of the user to update.attributes
- map of one-to-many attribute-values. All attribute keys are treated as new or updated attributes.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_USER_ATTRIBUTE
.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory- See Also:
-
removeUserAttributes
public void removeUserAttributes(long directoryId, String username, String attributeName) throws OperationFailedException, DirectoryPermissionException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Removes a user's attribute values in the directory specified by the passed indirectoryId
.- Specified by:
removeUserAttributes
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the user.username
- username of the user to update.attributeName
- all attribute values for this key will be removed from the user.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_USER_ATTRIBUTE
.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory- See Also:
-
updateUserCredential
public void updateUserCredential(long directoryId, String username, PasswordCredential credential) throws OperationFailedException, DirectoryPermissionException, InvalidCredentialException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
This will update the user's credential in the given directory specified by the passed indirectoryId
.- Specified by:
updateUserCredential
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the user.username
- username of the user to update.credential
- the new password credential for the user (unencrypted).- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_USER
.InvalidCredentialException
- if the new credential does not meet the requirements for the given directory.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory
-
removeUser
public void removeUser(long directoryId, String username) throws DirectoryPermissionException, OperationFailedException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Removes a user matching the supplied username in the directory specified by the passed indirectoryId
.- Specified by:
removeUser
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to remove the user from.username
- username of the user to remove.- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.DELETE_USER
.OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory
-
findGroupByName
public Group findGroupByName(long directoryId, String groupName) throws OperationFailedException, GroupNotFoundException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns the group matching the supplied groupName in the directory specified by the passed indirectoryId
..- Specified by:
findGroupByName
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.groupName
- groupName of the group to retrieve.- Returns:
- group matching the supplied groupName.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.GroupNotFoundException
- if no group with the supplied groupName exists in the directoryDirectoryNotFoundException
- if the directory with the given directoryId cannot be found.- See Also:
-
findGroupWithAttributesByName
public GroupWithAttributes findGroupWithAttributesByName(long directoryId, String groupName) throws OperationFailedException, GroupNotFoundException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns the group with all attributes matching the supplied groupName in the directory specified by the passed indirectoryId
..- Specified by:
findGroupWithAttributesByName
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.groupName
- groupName of the group to retrieve.- Returns:
- group (with all attributes) matching the supplied groupName.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.GroupNotFoundException
- if no group with the supplied groupName exists in the directoryDirectoryNotFoundException
- if the directory with the given directoryId cannot be found.- See Also:
-
searchGroups
public <T> List<T> searchGroups(long directoryId, EntityQuery<T> query) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns a list of groups matching the given query in the directory specified by the passed indirectoryId
.The groups will be returned in a stable order including across pagination boundaries (excluding modification).
- Specified by:
searchGroups
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.query
- query to exectute.- Returns:
- List of
Group
entities orString
groupNames matching the query criteria. - Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
addGroup
public Group addGroup(long directoryId, GroupTemplate group) throws InvalidGroupException, OperationFailedException, DirectoryPermissionException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Adds a Group to the directory specified by the passed indirectoryId
.- Specified by:
addGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to add the group to.group
- a template of the group to be added.- Returns:
- the added group returned from the directory.
- Throws:
InvalidGroupException
- if the group already exists in the given directory.OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.CREATE_GROUP
.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found after the add operation.
-
updateGroup
public Group updateGroup(long directoryId, GroupTemplate group) throws OperationFailedException, DirectoryPermissionException, InvalidGroupException, DirectoryNotFoundException, GroupNotFoundException, ReadOnlyGroupException Description copied from interface:DirectoryManager
Updates a group with the supplied template and returns the updated group retrieved from the directory specified by the passed indirectoryId
.This method cannot be used to rename the group, update the group's credentials or update the group's custom attributes.
- Specified by:
updateGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the group.group
- template of the group to update.- Returns:
- the updated group returned from the directory.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP
.InvalidGroupException
- if the group template does not have the required properties populated.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if no group with the supplied groupName exists in the directoryReadOnlyGroupException
- if the group is read-only- See Also:
-
renameGroup
public Group renameGroup(long directoryId, String oldGroupname, String newGroupname) throws OperationFailedException, DirectoryPermissionException, InvalidGroupException, DirectoryNotFoundException, GroupNotFoundException Description copied from interface:DirectoryManager
Renames a group in the directory specified by the passed indirectoryId
.- Specified by:
renameGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the group.oldGroupname
- current groupName of the group.newGroupname
- desired groupName of the group.- Returns:
- updated group returned from the directory.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP
.InvalidGroupException
- if the new groupName does not meet the groupName requirements of the directory or if a group already exists with the new groupName.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if the group with the oldGroupname does not exist in the directory or if the directory with the given directoryId cannot be found.
-
storeGroupAttributes
public void storeGroupAttributes(long directoryId, String groupName, Map<String, Set<String>> attributes) throws OperationFailedException, DirectoryPermissionException, DirectoryNotFoundException, GroupNotFoundExceptionDescription copied from interface:DirectoryManager
Adds or updates a group's attributes with the new Map of attribute values in the directory specified by the passed indirectoryId
.The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute matches the key of an existing attribute on the group.
This method does not update primary field attributes like firstName, lastName, etc.
- Specified by:
storeGroupAttributes
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the group.groupName
- groupName of the group to update.attributes
- map of one-to-many attribute-values. All attribute keys are treated as new or updated attributes.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP_ATTRIBUTE
.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if no group with the supplied groupName exists in the directory- See Also:
-
removeGroupAttributes
public void removeGroupAttributes(long directoryId, String groupName, String attributeName) throws OperationFailedException, DirectoryPermissionException, DirectoryNotFoundException, GroupNotFoundException Description copied from interface:DirectoryManager
Removes a group's attribute values in the directory specified by the passed indirectoryId
.- Specified by:
removeGroupAttributes
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to find and update the group.groupName
- groupName of the group to update.attributeName
- all attribute values for this key will be removed from the group.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP_ATTRIBUTE
.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if no group with the supplied groupName exists in the directory- See Also:
-
removeGroup
public void removeGroup(long directoryId, String groupName) throws DirectoryPermissionException, OperationFailedException, DirectoryNotFoundException, GroupNotFoundException, ReadOnlyGroupException Description copied from interface:DirectoryManager
Removes a group matching the supplied groupName in the directory specified by the passed indirectoryId
.- Specified by:
removeGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to remove the group from.groupName
- groupName of the group to remove.- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.DELETE_GROUP
.OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if no group with the supplied groupName exists in the directoryReadOnlyGroupException
- if the group is read-only
-
isUserDirectGroupMember
public boolean isUserDirectGroupMember(long directoryId, String username, String groupName) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returnstrue
if the user is a direct member of the group in the directory specified by the passed indirectoryId
.- Specified by:
isUserDirectGroupMember
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.username
- name of the user to inspect.groupName
- name of the group to inspect.- Returns:
true
if and only if the user is a direct member of the group. If the group or user does not exist in the directory,false
is returned.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
isGroupDirectGroupMember
public boolean isGroupDirectGroupMember(long directoryId, String childGroup, String parentGroup) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returnstrue
if the childGroup is a direct member of the parentGroup in the directory specified by the passed indirectoryId
.- Specified by:
isGroupDirectGroupMember
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.childGroup
- name of the group to inspect.parentGroup
- name of the group to inspect.- Returns:
true
if and only if the childGroup is a direct member of the parentGroup. If either group does not exist in the directory,false
is returned.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
addUserToGroup
public void addUserToGroup(long directoryId, String username, String groupName) throws DirectoryPermissionException, OperationFailedException, DirectoryNotFoundException, GroupNotFoundException, UserNotFoundException, ReadOnlyGroupException, MembershipAlreadyExistsException Description copied from interface:DirectoryManager
Adds an existing user as a direct member of an existing group in the directory specified by the passed indirectoryId
.- Specified by:
addUserToGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to add membership information.username
- username of the user.groupName
- name of the group.- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP
.OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if the group does not exist in the directoryUserNotFoundException
- if the user does not exist in the directoryReadOnlyGroupException
- if the group is read-onlyMembershipAlreadyExistsException
- if the user is already a member of the group
-
addGroupToGroup
public void addGroupToGroup(long directoryId, String childGroup, String parentGroup) throws DirectoryPermissionException, OperationFailedException, InvalidMembershipException, NestedGroupsNotSupportedException, DirectoryNotFoundException, GroupNotFoundException, ReadOnlyGroupException, MembershipAlreadyExistsException Description copied from interface:DirectoryManager
Adds an existing child group as direct member of an existing parent group in the directory specified by the passed indirectoryId
.- Specified by:
addGroupToGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to add membership information.childGroup
- name of child group.parentGroup
- name of the parent group.- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP
.OperationFailedException
- underlying directory implementation failed to execute the operation.InvalidMembershipException
- GroupType of childGroup does not match parentGroup.NestedGroupsNotSupportedException
- If the directory does not support nested groups.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if the group does not exist in the directoryReadOnlyGroupException
- if the group is read-onlyMembershipAlreadyExistsException
- if the child group is already a child of the parent group
-
removeUserFromGroup
public void removeUserFromGroup(long directoryId, String username, String groupName) throws DirectoryPermissionException, OperationFailedException, MembershipNotFoundException, DirectoryNotFoundException, GroupNotFoundException, UserNotFoundException, ReadOnlyGroupException Description copied from interface:DirectoryManager
Removes an existing user from being a direct member of an existing group in the directory specified by the passed indirectoryId
.- Specified by:
removeUserFromGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to add membership information.username
- username of the user.groupName
- name of the group.- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP
.OperationFailedException
- underlying directory implementation failed to execute the operation.MembershipNotFoundException
- user is not a direct member of group.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if the group does not exist in the directoryUserNotFoundException
- if the user does not exist in the directoryReadOnlyGroupException
- if the group is read-only
-
removeGroupFromGroup
public void removeGroupFromGroup(long directoryId, String childGroup, String parentGroup) throws DirectoryPermissionException, OperationFailedException, InvalidMembershipException, MembershipNotFoundException, DirectoryNotFoundException, GroupNotFoundException, ReadOnlyGroupException Description copied from interface:DirectoryManager
Removes an existing child group from being a direct member of an existing parent group in the directory specified by the passed indirectoryId
.- Specified by:
removeGroupFromGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to add membership information.childGroup
- name of child group.parentGroup
- name of the parent group.- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP
.OperationFailedException
- underlying directory implementation failed to execute the operation.InvalidMembershipException
- GroupType of childGroup does not match parentGroup.MembershipNotFoundException
- group is not a direct member of group.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if the group does not exist in the directoryReadOnlyGroupException
- if the group is read-only
-
searchDirectGroupRelationships
public <T> List<T> searchDirectGroupRelationships(long directoryId, MembershipQuery<T> query) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Searches for direct group relationships in the directory specified by the passed indirectoryId
.- Specified by:
searchDirectGroupRelationships
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.query
- membership query.- Returns:
- List of
User
entities,Group
entites,String
usernames orString
group names matching the query criteria. If there are no results, returns an empty List. - Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
searchDirectGroupRelationshipsGroupedByName
public <T> Map<String,List<T>> searchDirectGroupRelationshipsGroupedByName(long directoryId, MembershipQuery<T> query) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Searches for direct group relationships in the directory specified by the passed indirectoryId
.- Specified by:
searchDirectGroupRelationshipsGroupedByName
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.query
- membership query.- Returns:
- ListMultimap, where key is element of
MembershipQuery.getEntityNamesToMatch()
and the value is list ofUser
entities,Group
entites,String
usernames orString
group names matching the query criteria for the given key. - Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
countDirectMembersOfGroup
public BoundedCount countDirectMembersOfGroup(long directoryId, String groupName, int querySizeHint) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Count the direct members of a group in the provided directory with an upper bound. The upper bound is there so that, in directories that do not support efficient counting of memberships, the count request is not unbounded.- Specified by:
countDirectMembersOfGroup
in interfaceDirectoryManager
groupName
- the name of the group to search forquerySizeHint
- hinting at the maximum number of memberships that should be counted. The directory that implements this may choose to count less or more. This is a user provided suggestion for potential efficiency.- Returns:
- A bounded count of the number of memberships in the given group for the provided directory. If the group does not exist then exactly 0 will be returned.
- Throws:
OperationFailedException
- if we failed to count the number of memberships for that group in the given directory.DirectoryNotFoundException
- if a directory for the provided id could not be found.
-
isUserNestedGroupMember
@Transactional(readOnly=true) public boolean isUserNestedGroupMember(long directoryId, String username, String groupName) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returnstrue
if the user is a direct or indirect (nested) member of the group in the directory specified by the passed indirectoryId
.If the directory does not support nested groups, this call will be equivalent to
DirectoryManager.isUserDirectGroupMember(long, String, String)
.WARNING: this method could be very slow if the underlying RemoteDirectory does not employ caching.
- Specified by:
isUserNestedGroupMember
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.username
- name of the user to inspect.groupName
- name of the group to inspect.- Returns:
true
if and only if the user is a direct or indirect (nested) member of the group. If the group or user does not exist in the directory,false
is returned.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
isUserNestedGroupMember
@Transactional(readOnly=true) public boolean isUserNestedGroupMember(long directoryId, String username, Set<String> groupNames) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returnstrue
if the user is a direct or indirect (nested) member of any of the specified groups in the directory specified by the passed indirectoryId
.If the directory does not support nested groups, this call will be equivalent to
DirectoryManager.isUserDirectGroupMember(long, String, String)
.WARNING: this method could be very slow if the underlying RemoteDirectory does not employ caching.
- Specified by:
isUserNestedGroupMember
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.username
- name of the user to inspect.groupNames
- names of the group to inspect.- Returns:
true
if and only if the user is a direct or indirect (nested) member of any of the specified groups. If the groups or user do not exist in the directory,false
is returned.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
filterNestedUserMembersOfGroups
@Transactional(readOnly=true) public Set<String> filterNestedUserMembersOfGroups(long directoryId, Set<String> userNames, Set<String> groupNames) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns names of users who are (nested) members of any of the specified groups. WARNING: this method could be very slow if the underlying RemoteDirectory does not employ caching.- Specified by:
filterNestedUserMembersOfGroups
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.userNames
- names of users to inspect.groupNames
- names of groups to inspect.- Returns:
- names of users who are (nested) members of any of the specified groups.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
isGroupNestedGroupMember
@Transactional(readOnly=true) public boolean isGroupNestedGroupMember(long directoryId, String childGroupName, String parentGroupName) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returnstrue
if the childGroup is a direct or indirect (nested) member of the parentGroup in the directory specified by the passed indirectoryId
.If the directory does not support nested groups, this call will be equivalent to
DirectoryManager.isGroupDirectGroupMember(long, String, String)
.WARNING: this method could be very slow if the underlying RemoteDirectory does not employ caching.
- Specified by:
isGroupNestedGroupMember
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.childGroupName
- name of the user to inspect.parentGroupName
- name of the group to inspect.- Returns:
true
if and only if the childGroup is a direct or indirect (nested) member of the parentGruop. If either group does not exist in the directory,false
is returned.- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
searchNestedGroupRelationships
@Transactional(readOnly=true) public <T> List<T> searchNestedGroupRelationships(long directoryId, MembershipQuery<T> query) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Searches for direct and indirect (nested) group relationships in the directory specified by the passed indirectoryId
.If the directory does not support nested groups, this call will be equivalent to
DirectoryManager.searchDirectGroupRelationships(long, com.atlassian.crowd.search.query.membership.MembershipQuery)
.WARNING: this method could be very slow if the underlying RemoteDirectory does not employ caching.
- Specified by:
searchNestedGroupRelationships
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to inspect membership information.query
- membership query.- Returns:
- List of
User
entities,Group
entites,String
usernames orString
group names matching the query criteria. - Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
addAllUsers
public BulkAddResult<User> addAllUsers(long directoryId, Collection<UserTemplateWithCredentialAndAttributes> users, boolean overwrite) throws DirectoryPermissionException, OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Will add a collection of users to the directory specified by the passed indirectoryId
param.If adding a particular user fails then this user will be skipped and the error will be reported in the logs and the BulkAddResult object.
If the underlying directory supports bulk adding of entities (ie. implements
InternalRemoteDirectory
), it may be faster than manual iteration of each entity.- Specified by:
addAllUsers
in interfaceDirectoryManager
- Parameters:
directoryId
- the directory to add the User too.users
- the templates of the users to add.overwrite
-true
if you want to remove any existing user matching a username in the users to add prior to adding the user.false
if you want to skip over users that already exist (same username exists).- Returns:
- results for bulk add process.
- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.CREATE_USER
. or if theoverwrite
istrue
and the directory is not allowed to perform operations of typeOperationType.DELETE_USER
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
addAllGroups
public BulkAddResult<Group> addAllGroups(long directoryId, Collection<GroupTemplate> groups, boolean overwrite) throws DirectoryPermissionException, OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Will add a collection of Group to the directory specified by the passed indirectoryId
param.If adding a group fails then this user will be skipped and the error will be reported in the logs and the BulkAddResult object.
If the underlying directory supports bulk adding of entities (ie. implements
InternalRemoteDirectory
), it may be faster than manual iteration of each entity.- Specified by:
addAllGroups
in interfaceDirectoryManager
- Parameters:
directoryId
- the directory to add the Group too.groups
- the Groups to add.overwrite
-true
if you want to remove any existing group matching a username in the groups to add prior to adding the group.false
if you want to skip over groups that already exist (same group name exists).- Returns:
- results for bulk add process.
- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.CREATE_GROUP
. or if theoverwrite
istrue
and the directory is not allowed to perform operations of typeOperationType.DELETE_GROUP
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-
addAllUsersToGroup
public BulkAddResult<String> addAllUsersToGroup(long directoryId, Collection<String> userNames, String groupName) throws DirectoryPermissionException, OperationFailedException, DirectoryNotFoundException, GroupNotFoundException Description copied from interface:DirectoryManager
A bulk version ofDirectoryManager.addUserToGroup(long, String, String)
.If creating a particular membership fails, it will be skipped and the error will be reported in the logs and the BulkAddResult object.
If the underlying directory supports bulk adding of entities (ie. implements
InternalRemoteDirectory
), it may be faster than manual iteration of each entity.- Specified by:
addAllUsersToGroup
in interfaceDirectoryManager
- Parameters:
directoryId
- the directory to add the membership to.userNames
- usernames of users to add membership to.groupName
- name of group to add users to.- Returns:
- results for bulk add process consisting of the names of the users which could not be added to the group.
- Throws:
DirectoryPermissionException
- if the directory is not allowed to perform operations of typeOperationType.UPDATE_GROUP
.OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.GroupNotFoundException
- if the groupName did not resolve to a group
-
findUserByExternalId
public User findUserByExternalId(long directoryId, String externalId) throws DirectoryNotFoundException, UserNotFoundException, OperationFailedException Description copied from interface:DirectoryManager
Returns the user matching the supplied external ID in the directory specified by the passed indirectoryId
.- Specified by:
findUserByExternalId
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.externalId
- external Id of the user to retrieve.- Returns:
- user matching the supplied external ID.
- Throws:
DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied external ID exists in the directoryOperationFailedException
- underlying directory implementation failed to execute the operation.
-
findUserWithAttributesByExternalId
public UserWithAttributes findUserWithAttributesByExternalId(long directoryId, String externalId) throws DirectoryNotFoundException, UserNotFoundException, OperationFailedException Description copied from interface:DirectoryManager
Returns the user (with attributes) matching the supplied external ID in the directory specified by the passed indirectoryId
.- Specified by:
findUserWithAttributesByExternalId
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search.externalId
- external Id of the user to retrieve.- Returns:
- user (with attributes) matching the supplied external ID.
- Throws:
DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied external ID exists in the directoryOperationFailedException
- underlying directory implementation failed to execute the operation.
-
expireAllPasswords
public void expireAllPasswords(long directoryId) throws OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Sets theUserConstants.REQUIRES_PASSWORD_CHANGE
attribute to true for all users in the directory- Specified by:
expireAllPasswords
in interfaceDirectoryManager
- Throws:
OperationFailedException
DirectoryNotFoundException
-
supportsExpireAllPasswords
public boolean supportsExpireAllPasswords(long directoryId) throws DirectoryInstantiationException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Returns true if the underlying directory implementation supports expiring passwords- Specified by:
supportsExpireAllPasswords
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of directory.- Returns:
- true if the directory supports expiring passwords
- Throws:
DirectoryInstantiationException
- if there was an error instantiating the directoryDirectoryNotFoundException
- if the directory could not be found.
-
getUserAvatarByName
public AvatarReference getUserAvatarByName(long directoryId, String username, int sizeHint) throws UserNotFoundException, OperationFailedException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Return an avatar, if available, for the named user in the specified directory.- Specified by:
getUserAvatarByName
in interfaceDirectoryManager
sizeHint
- a hint in pixels for the context in which this will be used- Returns:
- an avatar, or
null
if none is available - Throws:
UserNotFoundException
OperationFailedException
DirectoryNotFoundException
-
findRemoteUserByName
@Nonnull public User findRemoteUserByName(Long directoryId, String username) throws OperationFailedException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Returns the user matching the supplied username in the authoritative remote directory specified by the passed indirectoryId
- Specified by:
findRemoteUserByName
in interfaceDirectoryManager
- Parameters:
directoryId
- ID of the directory to search its remote authoriative directoryusername
- username of the user to retrieve.- Returns:
- user matching the supplied username.
- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.DirectoryNotFoundException
- if the directory with the given directoryId cannot be found.UserNotFoundException
- if no user with the supplied username exists in the directory- See Also:
-
updateUserFromRemoteDirectory
public User updateUserFromRemoteDirectory(User remoteUser) throws OperationFailedException, DirectoryNotFoundException, UserNotFoundException Description copied from interface:DirectoryManager
Updates the user details for the specified user based on the details in the remote directory. Typically done as a part ofDirectoryManager.authenticateUser(long, String, PasswordCredential)
, but in case the user is authenticated in another way, it might be useful to update the user's data. Currently includes: - creating the user if he doesn't exist locally yet - renaming the user if the name has changed in remote - optionally updating the user group memberships, depending on the directory configuration- Specified by:
updateUserFromRemoteDirectory
in interfaceDirectoryManager
- Parameters:
remoteUser
- the remote user to update for- Returns:
- the internal user after the update
- Throws:
OperationFailedException
DirectoryNotFoundException
UserNotFoundException
-
findAuthorisedApplications
Description copied from interface:DirectoryManager
Finds all applications that a user from a given directory belonging to the specified groups can authenticate to.- Specified by:
findAuthorisedApplications
in interfaceDirectoryManager
- Parameters:
directoryId
- directory id of the user.groupNames
- group memberships of the user in the particular directory.- Returns:
- list of applications the user can authenticate to.
-
isInternalUserStatusSupported
public boolean isInternalUserStatusSupported(long directoryId) throws DirectoryInstantiationException, DirectoryNotFoundException Description copied from interface:DirectoryManager
Check if internal User status is supported by the directory- Specified by:
isInternalUserStatusSupported
in interfaceDirectoryManager
- Returns:
- true/false
- Throws:
DirectoryInstantiationException
- if there was an error instantiating the directoryDirectoryNotFoundException
- if the directory with the given directoryId cannot be found.
-