com.atlassian.confluence.it.usermanagement
Class LdapUserManagementHelper

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

public final class LdapUserManagementHelper
extends Object
implements UserManagementHelper

Implementation of UserManagementHelper that talks directly to the configured LDAP server. The underlying LDAP operations are handled by LdapServer.

Synchronises after each modification to ensure Confluence's local copy of LDAP data is up-to-date.


Constructor Summary
LdapUserManagementHelper(ConfluenceRpc rpc)
          Creates an instance which delegates to LdapServer.
LdapUserManagementHelper(ConfluenceRpc rpc, org.springframework.ldap.core.LdapTemplate ldapTemplate, Set<User> initialUsers, Set<Group> initialGroups)
          Creates an instance which delegates to LdapServer using the LDAP connections provided by the ldapTemplate.
 
Method Summary
 void addGroupToGroup(Group childGroup, Group parentGroup)
          Add childGroup to parentGroup.
 void addUserToGroup(String userName, String groupName)
           
 void addUserToGroup(User user, Group group)
           
 void changePassword(String username, String newPassword)
          Change a user's password.
 void createGroup(Group group)
           
 void createGroup(String groupName)
           
 void createUser(User user)
          Creates the user, adds it to the default confluence-users group, and ensures the user profile is created (to work around CONF-6404).
 void fixUser(User user)
          Ensure that the user's details in the system match those in user.
 boolean groupExists(String groupName)
           
 void removeExternalUsersAndGroups()
          Clean up any users and groups created by this user management helper or otherwise.
 void removeGroup(Group group)
           
 void removeGroup(String groupName)
           
 void removeUser(String username)
           
 void removeUser(User user)
           
 void removeUserFromGroup(String userName, String groupName)
           
 void removeUserFromGroup(User user, Group group)
           
 void removeUserUncleanly(String username)
          Removes a user with the given username but do not remove their dependent permissions or pages.
 void setAutoSync(boolean autoSync)
           
 void synchronise()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapUserManagementHelper

public LdapUserManagementHelper(ConfluenceRpc rpc)
Creates an instance which delegates to LdapServer.

Parameters:
rpc - The rpc helper

LdapUserManagementHelper

public LdapUserManagementHelper(ConfluenceRpc rpc,
                                org.springframework.ldap.core.LdapTemplate ldapTemplate,
                                Set<User> initialUsers,
                                Set<Group> initialGroups)
Creates an instance which delegates to LdapServer using the LDAP connections provided by the ldapTemplate.

Parameters:
rpc - Confluence RPC interface
ldapTemplate - used to connect to the LDAP server
initialUsers - the users which already exist in the LDAP server
initialGroups - the groups which already exist in the LDAP server
Method Detail

synchronise

public void synchronise()

addUserToGroup

public void addUserToGroup(String userName,
                           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

createUser

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

Specified by:
createUser in interface UserManagementHelper

removeExternalUsersAndGroups

public void removeExternalUsersAndGroups()
Description copied from interface: UserManagementHelper
Clean up any users and groups created by this user management helper or otherwise.

Specified by:
removeExternalUsersAndGroups in interface UserManagementHelper

removeUser

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

removeUser

public void removeUser(User user)

createGroup

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

createGroup

public void createGroup(Group group)

groupExists

public boolean groupExists(String groupName)

removeUserFromGroup

public void removeUserFromGroup(User user,
                                Group group)

removeUserFromGroup

public void removeUserFromGroup(String userName,
                                String groupName)
Specified by:
removeUserFromGroup in interface UserManagementHelper

removeGroup

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

removeGroup

public void removeGroup(Group group)

removeUserUncleanly

public void removeUserUncleanly(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

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(String username,
                           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)


Copyright © 2003-2011 Atlassian. All Rights Reserved.