com.atlassian.jira.user.util
Class DefaultUserManager

java.lang.Object
  extended by com.atlassian.jira.user.util.DefaultUserManager
All Implemented Interfaces:
UserManager

public class DefaultUserManager
extends Object
implements UserManager


Constructor Summary
DefaultUserManager(com.atlassian.crowd.embedded.api.CrowdService crowdService, com.atlassian.crowd.embedded.api.CrowdDirectoryService crowdDirectoryService, ApplicationProperties applicationProperties)
           
 
Method Summary
 boolean canDirectoryUpdateUserPassword(com.atlassian.crowd.embedded.api.Directory directory)
          Checks if the given directory is able to update user passwords.
 boolean canUpdateGroupMembershipForUser(com.atlassian.crowd.embedded.api.User user)
          Test if this user's group membership can be updated, i.e.
 boolean canUpdateUser(com.atlassian.crowd.embedded.api.User user)
          Test if this user can be updated, i.e.
 boolean canUpdateUserPassword(com.atlassian.crowd.embedded.api.User user)
          Test if this user's password can be updated, i.e.
 com.atlassian.crowd.embedded.api.User findUserInDirectory(String userName, Long directoryId)
          Returns a User based on user name and directoryId
 Set<Group> getAllGroups()
          Returns all groups defined in JIRA.
 Set<User> getAllUsers()
          Returns all users defined in JIRA, regardless of whether they are active or not.
 com.atlassian.crowd.embedded.api.Directory getDirectory(Long directoryId)
           
 Group getGroup(String groupName)
          Returns a Group based on user name.
 com.atlassian.crowd.embedded.api.Group getGroupObject(String groupName)
          Returns a Group based on user name.
 Collection<com.atlassian.crowd.embedded.api.Group> getGroups()
          Returns all groups defined in JIRA.
 int getTotalUserCount()
          Returns the total number of users defined in JIRA, regardless of whether they are active or not.
 User getUser(String userName)
          Returns a User based on user name.
 com.atlassian.crowd.embedded.api.User getUserEvenWhenUnknown(String userName)
          Returns a User based on user name.
 com.atlassian.crowd.embedded.api.User getUserObject(String userName)
          Returns a User based on user name.
 Collection<com.atlassian.crowd.embedded.api.User> getUsers()
          Returns all users defined in JIRA, regardless of whether they are active or not.
 List<com.atlassian.crowd.embedded.api.Directory> getWritableDirectories()
          Returns an ordered list of directories that have "read-write" permission.
 boolean hasPasswordWritableDirectory()
          Returns true if any of the directories have permission to update user passwords, false if otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUserManager

public DefaultUserManager(com.atlassian.crowd.embedded.api.CrowdService crowdService,
                          com.atlassian.crowd.embedded.api.CrowdDirectoryService crowdDirectoryService,
                          ApplicationProperties applicationProperties)
Method Detail

getTotalUserCount

public int getTotalUserCount()
Description copied from interface: UserManager
Returns the total number of users defined in JIRA, regardless of whether they are active or not.

Specified by:
getTotalUserCount in interface UserManager
Returns:
the total number of users defined in JIRA

getUsers

public Collection<com.atlassian.crowd.embedded.api.User> getUsers()
Description copied from interface: UserManager
Returns all users defined in JIRA, regardless of whether they are active or not.

Specified by:
getUsers in interface UserManager
Returns:
the collection of all users

getAllUsers

public Set<User> getAllUsers()
Description copied from interface: UserManager
Returns all users defined in JIRA, regardless of whether they are active or not.

Specified by:
getAllUsers in interface UserManager
Returns:
the set of all users

getUser

public User getUser(String userName)
Description copied from interface: UserManager
Returns a User based on user name.

Specified by:
getUser in interface UserManager
Parameters:
userName - the user name of the user
Returns:
the User object, or null if the user cannot be found including null userName.

getUserObject

public com.atlassian.crowd.embedded.api.User getUserObject(@Nullable
                                                           String userName)
Description copied from interface: UserManager
Returns a User based on user name.

Specified by:
getUserObject in interface UserManager
Parameters:
userName - the user name of the user
Returns:
the User object, or null if the user cannot be found including null userName.

findUserInDirectory

public com.atlassian.crowd.embedded.api.User findUserInDirectory(String userName,
                                                                 Long directoryId)
Description copied from interface: UserManager
Returns a User based on user name and directoryId

Specified by:
findUserInDirectory in interface UserManager
Parameters:
userName - the user name of the user
directoryId - the Directory to look in
Returns:
the User object, or null if the user cannot be found including null userName.

getUserEvenWhenUnknown

public com.atlassian.crowd.embedded.api.User getUserEvenWhenUnknown(String userName)
Description copied from interface: UserManager
Returns a User based on user name.

If a null username is passed, then a null User object is returned, but it is guaranteed to return a non-null User in all other cases.
If the username is not null, but the User is not found then a proxy unknown immutable User object is returned.

Specified by:
getUserEvenWhenUnknown in interface UserManager
Parameters:
userName - the user name of the user
Returns:
the User object, or proxy unknown immutable User object (null iff the username is null).

canUpdateUser

public boolean canUpdateUser(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserManager
Test if this user can be updated, i.e. is in a writable directory. This relies upon the local directory configuration and does not guarantee that the actual remote directory, e.g. the remote LDAP directory, will actually allow the user to be updated.

If the "External user management" setting is on, then you cannot update the user.

Specified by:
canUpdateUser in interface UserManager
Parameters:
user - The user to update.
Returns:
true if the user can be updated.

canUpdateUserPassword

public boolean canUpdateUserPassword(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserManager
Test if this user's password can be updated, i.e. is in a writable directory which is not a Delegated LDAP directory. This relies upon the local directory configuration and does not guarantee that the actual remote directory, e.g. the remote LDAP directory, will actually allow the user to be updated.

If the "External user management", or "External password management" setting is on, then you cannot update the password.

Specified by:
canUpdateUserPassword in interface UserManager
Parameters:
user - The user to update.
Returns:
true if the user's password can be updated.

canUpdateGroupMembershipForUser

public boolean canUpdateGroupMembershipForUser(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserManager
Test if this user's group membership can be updated, i.e. is in a writable directory or a directory with Local Group support. This relies upon the local directory configuration and does not guarantee that the actual remote directory, e.g. the remote LDAP directory, will actually allow the user membership to be updated.

Specified by:
canUpdateGroupMembershipForUser in interface UserManager
Parameters:
user - The user to update.
Returns:
true if the user can be updated.

getGroups

public Collection<com.atlassian.crowd.embedded.api.Group> getGroups()
Description copied from interface: UserManager
Returns all groups defined in JIRA.

Specified by:
getGroups in interface UserManager
Returns:
the set of all groups

getAllGroups

public Set<Group> getAllGroups()
Description copied from interface: UserManager
Returns all groups defined in JIRA.

Specified by:
getAllGroups in interface UserManager
Returns:
the set of all groups

getGroup

public Group getGroup(String groupName)
Description copied from interface: UserManager
Returns a Group based on user name.

Specified by:
getGroup in interface UserManager
Parameters:
groupName - the user name of the group
Returns:
the Group object, or null if the user cannot be found including null groupName.

getGroupObject

public com.atlassian.crowd.embedded.api.Group getGroupObject(@Nullable
                                                             String groupName)
Description copied from interface: UserManager
Returns a Group based on user name.

WARNING: This method will be changed to return a Group. Since v4.3

Specified by:
getGroupObject in interface UserManager
Parameters:
groupName - the user name of the group
Returns:
the Group object, or null if the user cannot be found including null groupName.

getWritableDirectories

public List<com.atlassian.crowd.embedded.api.Directory> getWritableDirectories()
Description copied from interface: UserManager
Returns an ordered list of directories that have "read-write" permission. ie those directories that we can add a user to.

Specified by:
getWritableDirectories in interface UserManager
Returns:
an ordered list of directories that have "read-write" permission.

hasPasswordWritableDirectory

public boolean hasPasswordWritableDirectory()
Description copied from interface: UserManager
Returns true if any of the directories have permission to update user passwords, false if otherwise.

Specified by:
hasPasswordWritableDirectory in interface UserManager
Returns:
true if any of the directories have permission to update user passwords, false if otherwise.

getDirectory

public com.atlassian.crowd.embedded.api.Directory getDirectory(Long directoryId)
Specified by:
getDirectory in interface UserManager

canDirectoryUpdateUserPassword

public boolean canDirectoryUpdateUserPassword(com.atlassian.crowd.embedded.api.Directory directory)
Description copied from interface: UserManager
Checks if the given directory is able to update user passwords.

Specified by:
canDirectoryUpdateUserPassword in interface UserManager
Returns:
true if the directory can update user passwords, false if otherwise.


Copyright © 2002-2011 Atlassian. All Rights Reserved.