com.atlassian.crowd.directory
Interface InternalRemoteDirectory

All Superinterfaces:
com.atlassian.crowd.embedded.api.Attributes, RemoteDirectory

public interface InternalRemoteDirectory
extends RemoteDirectory

This interface represents a specialised extension of RemoteDirectory that is used by InternalDirectories.

In particular, the findUserByName(String) and findGroupByName(String) have been redefined to return TimestampedUser and InternalDirectoryGroup. The InternalDirectoryGroup allows clients to determine whether the group is "local".


Method Summary
 BatchResult<Group> addAllGroups(Set<GroupTemplate> groups)
          Adds a collection of groups to the directory.
 BatchResult<User> addAllUsers(Set<UserTemplateWithCredentialAndAttributes> users)
          Adds a collection of users to the directory.
 BatchResult<String> addAllUsersToGroup(Set<String> userNames, String groupName)
          Adds a collection of users to a group.
 Group addLocalGroup(GroupTemplate group)
          Adds a "local" group to the directory.
 InternalDirectoryGroup findGroupByName(String name)
          Finds the group that matches the supplied name.
 TimestampedUser findUserByExternalId(String externalId)
          Finds the user that matches the supplied externalId.
 TimestampedUser findUserByName(String name)
          Finds the user that matches the supplied name.
 User forceRenameUser(User oldUser, String newName)
          Forces a rename on the given user in this directory.
 boolean isLocalUserStatusEnabled()
          Returns true if user active status is updated independently in the Crowd cache and the remote directory.
 BatchResult<String> removeAllGroups(Set<String> groupNames)
          Removes all groups from the directory.
 BatchResult<String> removeAllUsers(Set<String> usernames)
          Removes all users from the directory.
 
Methods inherited from interface com.atlassian.crowd.directory.RemoteDirectory
addGroup, addGroupToGroup, addUser, addUserToGroup, authenticate, findGroupWithAttributesByName, findUserWithAttributesByName, getAuthoritativeDirectory, getDescriptiveName, getDirectoryId, getMemberships, isGroupDirectGroupMember, isRolesDisabled, isUserDirectGroupMember, removeGroup, removeGroupAttributes, removeGroupFromGroup, removeUser, removeUserAttributes, removeUserFromGroup, renameGroup, renameUser, searchGroupRelationships, searchGroups, searchUsers, setAttributes, setDirectoryId, storeGroupAttributes, storeUserAttributes, supportsInactiveAccounts, supportsNestedGroups, testConnection, updateGroup, updateUser, updateUserCredential
 
Methods inherited from interface com.atlassian.crowd.embedded.api.Attributes
getKeys, getValue, getValues, isEmpty
 

Method Detail

findUserByName

TimestampedUser findUserByName(String name)
                               throws UserNotFoundException
Description copied from interface: RemoteDirectory
Finds the user that matches the supplied name.

Specified by:
findUserByName in interface RemoteDirectory
Parameters:
name - the name of the user (username).
Returns:
TimestampedUser entity.
Throws:
UserNotFoundException - a user with the supplied name does not exist.

findUserByExternalId

TimestampedUser findUserByExternalId(String externalId)
                                     throws UserNotFoundException
Description copied from interface: RemoteDirectory
Finds the user that matches the supplied externalId. This is an optional method that may not be implemented on all directory types. Currently it is implemented for LDAP and Internal directories but not Crowd directories.

Specified by:
findUserByExternalId in interface RemoteDirectory
Parameters:
externalId - the externalId of the user
Returns:
TimestampedUser entity.
Throws:
UserNotFoundException - a user with the supplied externalId does not exist.
See Also:
RemoteDirectory.findUserByName(String)

findGroupByName

InternalDirectoryGroup findGroupByName(String name)
                                       throws GroupNotFoundException
Description copied from interface: RemoteDirectory
Finds the group that matches the supplied name.

Specified by:
findGroupByName in interface RemoteDirectory
Parameters:
name - the name of the group.
Returns:
InternalDirectoryGroup entity.
Throws:
GroupNotFoundException - a group with the supplied name does not exist.

addLocalGroup

Group addLocalGroup(GroupTemplate group)
                    throws InvalidGroupException,
                           OperationFailedException
Adds a "local" group to the directory.

This method can be used to store groups that aren't clones of "external" groups. For example, if an LDAP directory is cloned in an internal directory, it's possible to define "local" groups that exist internally but not in LDAP.

This functionality was added to meet the functionality that Confluence provided.

Parameters:
group - template of the group to add.
Returns:
the added group retrieved from the underlying store.
Throws:
InvalidGroupException - The supplied group is invalid.
OperationFailedException - underlying directory implementation failed to execute the operation.

addAllUsers

BatchResult<User> addAllUsers(Set<UserTemplateWithCredentialAndAttributes> users)
Adds a collection of users to the directory.

The bulk adding of users may be significantly faster than adding users one-by-one for large collections.

Caller must ensure that the users don't already exist.

Parameters:
users - templates of users to add.
Returns:
result containing both successful and failed users
Throws:
IllegalArgumentException - if any of the users' directory ID does not match the directory's ID.

addAllGroups

BatchResult<Group> addAllGroups(Set<GroupTemplate> groups)
Adds a collection of groups to the directory.

The bulk adding of groups may be significantly faster than adding groups one-by-one for large collections.

Caller must ensure that the users don't already exist.

Parameters:
groups - templates of groups to add.
Returns:
result containing both successful and failed groups
Throws:
IllegalArgumentException - if any of the groups' directory ID does not match the directory's ID.

addAllUsersToGroup

BatchResult<String> addAllUsersToGroup(Set<String> userNames,
                                       String groupName)
                                       throws GroupNotFoundException
Adds a collection of users to a group.

Caller must ensure that the memberships don't already exist.

Parameters:
userNames - names of users to add to group.
groupName - name of group to add users to.
Returns:
result containing both successful and failed users
Throws:
GroupNotFoundException - group with supplied groupName does not exist.

removeAllUsers

BatchResult<String> removeAllUsers(Set<String> usernames)
Removes all users from the directory.

If a user with the supplied username does not exist in the directory, the username will be ignored.

Parameters:
usernames - usernames of users to remove.
Returns:
batch result containing successes (removed users) and failures (users which were not removed)

removeAllGroups

BatchResult<String> removeAllGroups(Set<String> groupNames)
Removes all groups from the directory.

If a group with the supplied group name does not exist in the directory, the group name will be ignored.

Parameters:
groupNames - names of groups to remove.
Returns:
batch result containing successes (removed groups) and failures (groups which were not removed)

isLocalUserStatusEnabled

boolean isLocalUserStatusEnabled()
Returns true if user active status is updated independently in the Crowd cache and the remote directory. Otherwise, user status is synchronised between the cache and the remote directory.

Returns:
true if user status in the cache is updated independently of the remote directory.

forceRenameUser

User forceRenameUser(@Nonnull
                     User oldUser,
                     @Nonnull
                     String newName)
                     throws UserNotFoundException
Forces a rename on the given user in this directory. This works like RemoteDirectory.renameUser(String, String), except it will still do the rename even if there is an existing user under the newName. In this case, it will first rename that existing user to a name that is known not to exist in this directory.

Parameters:
oldUser - the existing user.
newName - desired name of user.
Returns:
renamed user.
Throws:
UserNotFoundException - if the "oldUser" does not exist.
See Also:
RemoteDirectory.renameUser(String, String)


Copyright © 2014 Atlassian. All Rights Reserved.