@PublicApi public class CrowdUserManager extends Object implements UserManager
UserManager
that talks to a Crowd server.Constructor and Description |
---|
CrowdUserManager(com.atlassian.crowd.service.client.CrowdClient crowdClient,
ConfluenceRpcClient rpcClient,
ConfluenceRestClient restClient) |
Modifier and Type | Method and Description |
---|---|
void |
activateUser(String username) |
void |
addGroupToGroup(Group childGroup,
Group parentGroup)
Add childGroup to parentGroup.
|
void |
addUserToGroup(String userName,
String groupName) |
void |
changePassword(String username,
String newPassword)
Change a user's password.
|
void |
createGroup(String groupName) |
UserWithDetails |
createUser(UserWithDetails user)
Creates the user, adds it to the default users group, and ensures the
user profile is created (to work around CONF-6404).
|
void |
deactivateUser(String username) |
void |
endBatch()
Flag that the batch transactions are complete, that a sync should be performed immediately, and that syncing
should be re-enabled for future requests.
|
void |
fixUser(UserWithDetails user)
Ensure that the user's details in the system match those in
user . |
Set<String> |
getUserGroups(User user) |
boolean |
isExternal()
Return true if this helper modifies Users, Groups and Group Memberships via RPC.
|
void |
removeGroup(String groupName) |
void |
removeGroupUncleanly(String group)
Removes a group but do not remove their dependent permissions.
|
void |
removeMultipleUsers(List<String> users)
Removes the list of users (calls
UserManager.removeUser(String) ) |
void |
removeUser(String username) |
void |
removeUserFromGroup(String user,
String group) |
void |
removeUserUncleanly(String username)
Removes a user with the given username but do not remove their dependent permissions or pages.
|
void |
renameUser(String oldUsername,
String newUsername) |
void |
resetData(Set<User> usersToKeep,
Set<Group> groupsToKeep,
Map<Group,HashSet<User>> userGroupMembershipsToKeep)
Return the User/Group/Membership data to a clean state.
|
List<String> |
searchGroupNames(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction,
int startIndex,
int maxResults)
Searches for group names matching the searchRestriction criteria.
|
List<Group> |
searchGroups(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction,
int startIndex,
int maxResults)
Searches for groups matching the following criteria.
|
List<String> |
searchUserNames(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction,
int startIndex,
int maxResults)
Searches for usernames matching the searchRestriction criteria.
|
List<UserWithDetails> |
searchUsers(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction,
int startIndex,
int maxResults)
Searches for users matching the following criteria.
|
void |
setAutoSync(boolean autoSync) |
void |
startBatch()
Flag that a number of user/group transactions are about to be performed in a block, and any syncing should
pause until the batch is finished.
|
void |
synchronise()
Force a synchronisation with an external user directory.
|
public CrowdUserManager(com.atlassian.crowd.service.client.CrowdClient crowdClient, ConfluenceRpcClient rpcClient, ConfluenceRestClient restClient)
public UserWithDetails createUser(UserWithDetails user)
UserManager
createUser
in interface UserManager
public void addUserToGroup(String userName, String groupName)
addUserToGroup
in interface UserManager
public void addGroupToGroup(Group childGroup, Group parentGroup)
UserManager
addGroupToGroup
in interface UserManager
public Set<String> getUserGroups(User user)
getUserGroups
in interface UserManager
user
- the user who's group membership is to be checked.public void resetData(Set<User> usersToKeep, Set<Group> groupsToKeep, Map<Group,HashSet<User>> userGroupMembershipsToKeep)
UserManager
resetData
in interface UserManager
usersToKeep
- the set of users to keep when resettinggroupsToKeep
- the set of groups to keep when resettinguserGroupMembershipsToKeep
- the memberships to keeppublic boolean isExternal()
UserManager
isExternal
in interface UserManager
public void removeUser(String username)
removeUser
in interface UserManager
public void createGroup(String groupName)
createGroup
in interface UserManager
public void removeUserFromGroup(String user, String group)
removeUserFromGroup
in interface UserManager
public void removeGroup(String groupName)
removeGroup
in interface UserManager
public void removeMultipleUsers(List<String> users)
UserManager
UserManager.removeUser(String)
)removeMultipleUsers
in interface UserManager
users
- the list of users to removepublic void removeUserUncleanly(String username)
UserManager
removeUserUncleanly
in interface UserManager
username
- the username of the user to removepublic void removeGroupUncleanly(String group)
UserManager
removeGroupUncleanly
in interface UserManager
group
- the group to removepublic void fixUser(UserWithDetails user)
UserManager
user
. That is,
it finds the user in the system by its username, and sets the full name and email address.fixUser
in interface UserManager
user
- a user to set the details ofpublic void changePassword(String username, String newPassword)
UserManager
changePassword
in interface UserManager
username
- Username of the user whose password to changenewPassword
- Passwordpublic void setAutoSync(boolean autoSync)
setAutoSync
in interface UserManager
public void synchronise()
UserManager
synchronise
in interface UserManager
public void startBatch()
UserManager
startBatch
in interface UserManager
public void endBatch()
UserManager
endBatch
in interface UserManager
public void renameUser(String oldUsername, String newUsername)
renameUser
in interface UserManager
public void deactivateUser(String username)
deactivateUser
in interface UserManager
public void activateUser(String username)
activateUser
in interface UserManager
public List<UserWithDetails> searchUsers(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction, int startIndex, int maxResults)
UserManager
searchUsers
in interface UserManager
searchRestriction
- restriction on the searchstartIndex
- starting index of the search resultsmaxResults
- maximum number of results returned from the searchpublic List<String> searchUserNames(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction, int startIndex, int maxResults)
UserManager
searchUserNames
in interface UserManager
searchRestriction
- restriction on the searchstartIndex
- starting index of the search resultsmaxResults
- maximum number of results returned from the searchpublic List<Group> searchGroups(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction, int startIndex, int maxResults)
UserManager
searchGroups
in interface UserManager
searchRestriction
- restriction on the searchstartIndex
- starting index of the search resultsmaxResults
- maximum number of results returned from the searchpublic List<String> searchGroupNames(com.atlassian.crowd.embedded.api.SearchRestriction searchRestriction, int startIndex, int maxResults)
UserManager
searchGroupNames
in interface UserManager
searchRestriction
- restriction on the searchstartIndex
- starting index of the search resultsmaxResults
- maximum number of results returned from the searchCopyright © 2003–2017 Atlassian. All rights reserved.