com.atlassian.confluence.it.usermanagement
Class CrowdUserManagementHelper

java.lang.Object
  extended by com.atlassian.confluence.it.usermanagement.CrowdUserManagementHelper
All Implemented Interfaces:
UserManagementHelper

public class CrowdUserManagementHelper
extends java.lang.Object
implements UserManagementHelper

Implementation of UserManagementHelper that talks to a Crowd server.

Since:
v4.2

Constructor Summary
CrowdUserManagementHelper(com.atlassian.crowd.service.client.CrowdClient crowdClient, ConfluenceRpc rpc)
           
 
Method Summary
 void addGroupToGroup(Group childGroup, Group parentGroup)
          Add childGroup to parentGroup.
 void addUserToGroup(java.lang.String userName, java.lang.String groupName)
           
 void addUserToGroup(User user, Group group)
           
 void changePassword(java.lang.String username, java.lang.String newPassword)
          Change a user's password.
 void createGroup(Group group)
           
 void createGroup(java.lang.String groupName)
           
 java.util.List<User> createMultipleUsers(int numUsers)
          Helper to create multiple users (calls UserManagementHelper.createUser(com.atlassian.confluence.it.User))
 User createUser(User user)
          Creates the user, adds it to the default users group, and ensures the user profile is created (to work around CONF-6404).
 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(User user)
          Ensure that the user's details in the system match those in user.
 java.util.Set<java.lang.String> getUserGroups(User user)
           
 boolean isExternal()
          Return true if this helper modifies Users, Groups and Group Memberships via RPC.
 void removeGroup(java.lang.String groupName)
           
 void removeGroupUncleanly(Group group)
          Removes a group but do not remove their dependent permissions.
 void removeMultipleUsers(java.util.List<User> users)
          Removes the list of users (calls UserManagementHelper.removeUser(User))
 void removeUser(java.lang.String username)
           
 void removeUser(User user)
           
 void removeUserFromGroup(User user, Group group)
           
 void removeUserUncleanly(java.lang.String username)
          Removes a user with the given username but do not remove their dependent permissions or pages.
 void removeUserUncleanly(User user)
          Removes a user but do not remove their dependent permissions or pages.
 void renameUser(java.lang.String oldUsername, java.lang.String newUsername)
           
 void resetData(java.util.Set<User> usersToKeep, java.util.Set<Group> groupsToKeep, java.util.Map<Group,java.util.HashSet<User>> userGroupMembershipsToKeep)
          Return the User/Group/Membership data to a clean state.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrowdUserManagementHelper

public CrowdUserManagementHelper(com.atlassian.crowd.service.client.CrowdClient crowdClient,
                                 ConfluenceRpc rpc)
Method Detail

createUser

public User createUser(User user)
Description copied from interface: UserManagementHelper
Creates the user, adds it to the default users group, and ensures the user profile is created (to work around CONF-6404).

Specified by:
createUser in interface UserManagementHelper

addUserToGroup

public void addUserToGroup(java.lang.String userName,
                           java.lang.String groupName)
Specified by:
addUserToGroup in interface UserManagementHelper

addUserToGroup

public void addUserToGroup(User user,
                           Group group)
Specified by:
addUserToGroup in interface UserManagementHelper

addGroupToGroup

public void addGroupToGroup(Group childGroup,
                            Group parentGroup)
Description copied from interface: UserManagementHelper
Add childGroup to parentGroup. Does nothing if the membership already exists.

Specified by:
addGroupToGroup in interface UserManagementHelper

getUserGroups

public java.util.Set<java.lang.String> getUserGroups(User user)
Specified by:
getUserGroups in interface UserManagementHelper
Parameters:
user - the user who's group membership is to be checked.
Returns:
the set of groups the user belongs to or an empty Set if none.

resetData

public void resetData(java.util.Set<User> usersToKeep,
                      java.util.Set<Group> groupsToKeep,
                      java.util.Map<Group,java.util.HashSet<User>> userGroupMembershipsToKeep)
Description copied from interface: UserManagementHelper
Return the User/Group/Membership data to a clean state.

Specified by:
resetData in interface UserManagementHelper

isExternal

public boolean isExternal()
Description copied from interface: UserManagementHelper
Return true if this helper modifies Users, Groups and Group Memberships via RPC. Return false if this helper makes calls to different server, e.g. LDAP or Crowd.

Specified by:
isExternal in interface UserManagementHelper

removeUser

public void removeUser(java.lang.String username)
Specified by:
removeUser in interface UserManagementHelper

removeUser

public void removeUser(User user)
Specified by:
removeUser in interface UserManagementHelper

createGroup

public void createGroup(java.lang.String groupName)
Specified by:
createGroup in interface UserManagementHelper

createGroup

public void createGroup(Group group)
Specified by:
createGroup in interface UserManagementHelper

removeUserFromGroup

public void removeUserFromGroup(User user,
                                Group group)
Specified by:
removeUserFromGroup in interface UserManagementHelper

removeGroup

public void removeGroup(java.lang.String groupName)
Specified by:
removeGroup in interface UserManagementHelper

createMultipleUsers

public java.util.List<User> createMultipleUsers(int numUsers)
Description copied from interface: UserManagementHelper
Helper to create multiple users (calls UserManagementHelper.createUser(com.atlassian.confluence.it.User))

Specified by:
createMultipleUsers in interface UserManagementHelper
Parameters:
numUsers - the number of users to create
Returns:
the list of users created

removeMultipleUsers

public void removeMultipleUsers(java.util.List<User> users)
Description copied from interface: UserManagementHelper
Removes the list of users (calls UserManagementHelper.removeUser(User))

Specified by:
removeMultipleUsers in interface UserManagementHelper
Parameters:
users - the list of users to remove

removeUserUncleanly

public void removeUserUncleanly(java.lang.String username)
Description copied from interface: UserManagementHelper
Removes a user with the given username but do not remove their dependent permissions or pages.

Specified by:
removeUserUncleanly in interface UserManagementHelper
Parameters:
username - the username of the user to remove

removeUserUncleanly

public void removeUserUncleanly(User user)
Description copied from interface: UserManagementHelper
Removes a user but do not remove their dependent permissions or pages.

Specified by:
removeUserUncleanly in interface UserManagementHelper
Parameters:
user - the user to remove

removeGroupUncleanly

public void removeGroupUncleanly(Group group)
Description copied from interface: UserManagementHelper
Removes a group but do not remove their dependent permissions.

Specified by:
removeGroupUncleanly in interface UserManagementHelper
Parameters:
group - the group to remove

fixUser

public void fixUser(User user)
Description copied from interface: UserManagementHelper
Ensure that the user's details in the system match those in user. That is, it finds the user in the system by its username, and sets the full name and email address.

Specified by:
fixUser in interface UserManagementHelper
Parameters:
user - a user to set the details of

changePassword

public void changePassword(java.lang.String username,
                           java.lang.String newPassword)
Description copied from interface: UserManagementHelper
Change a user's password.

Specified by:
changePassword in interface UserManagementHelper
Parameters:
username - Username of the user whose password to change
newPassword - Password

setAutoSync

public void setAutoSync(boolean autoSync)
Specified by:
setAutoSync in interface UserManagementHelper

synchronise

public void synchronise()
Description copied from interface: UserManagementHelper
Force a synchronisation with an external user directory.

Specified by:
synchronise in interface UserManagementHelper

startBatch

public void startBatch()
Description copied from interface: UserManagementHelper
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.

Specified by:
startBatch in interface UserManagementHelper

endBatch

public void endBatch()
Description copied from interface: UserManagementHelper
Flag that the batch transactions are complete, that a sync should be performed immediately, and that syncing should be re-enabled for future requests.

Specified by:
endBatch in interface UserManagementHelper

renameUser

public void renameUser(java.lang.String oldUsername,
                       java.lang.String newUsername)
Specified by:
renameUser in interface UserManagementHelper


Copyright © 2003-2013 Atlassian. All Rights Reserved.