com.atlassian.jira.user.util
Interface UserManager

All Known Implementing Classes:
DefaultUserManager

public interface UserManager

Simple user utilities that do not require an implementation with too many dependencies.

Since:
v4.0

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()
          Deprecated. Use getGroups(). Since v4.3
 Set<User> getAllUsers()
          Deprecated. Use getUsers(). Since v4.3
 com.atlassian.crowd.embedded.api.Directory getDirectory(Long directoryId)
           
 Group getGroup(String groupName)
          Deprecated. Since v4.3. Use getGroupObject(String).
 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)
          Deprecated. Since v4.3. Use getUserObject(String).
 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.
 

Method Detail

getTotalUserCount

int getTotalUserCount()
Returns the total number of users defined in JIRA, regardless of whether they are active or not.

Returns:
the total number of users defined in JIRA
Since:
v4.0

getAllUsers

@NotNull
Set<User> getAllUsers()
Deprecated. Use getUsers(). Since v4.3

Returns all users defined in JIRA, regardless of whether they are active or not.

Returns:
the set of all users
Since:
v4.0

getUsers

@NotNull
Collection<com.atlassian.crowd.embedded.api.User> getUsers()
Returns all users defined in JIRA, regardless of whether they are active or not.

Returns:
the collection of all users
Since:
v4.3

getUser

User getUser(@Nullable
             String userName)
Deprecated. Since v4.3. Use getUserObject(String).

Returns a User based on user name.

Parameters:
userName - the user name of the user
Returns:
the User object, or null if the user cannot be found including null userName.
Since:
v4.0

getUserObject

com.atlassian.crowd.embedded.api.User getUserObject(@Nullable
                                                    String userName)
Returns a User based on user name.

Parameters:
userName - the user name of the user
Returns:
the User object, or null if the user cannot be found including null userName.
Since:
v4.3

findUserInDirectory

com.atlassian.crowd.embedded.api.User findUserInDirectory(String userName,
                                                          Long directoryId)
Returns a User based on user name and directoryId

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.
Since:
v4.3.2

getUserEvenWhenUnknown

com.atlassian.crowd.embedded.api.User getUserEvenWhenUnknown(String userName)
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.

Parameters:
userName - the user name of the user
Returns:
the User object, or proxy unknown immutable User object (null iff the username is null).
Since:
v4.3

canUpdateUser

boolean canUpdateUser(com.atlassian.crowd.embedded.api.User user)
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.

Parameters:
user - The user to update.
Returns:
true if the user can be updated.

canUpdateUserPassword

boolean canUpdateUserPassword(com.atlassian.crowd.embedded.api.User user)
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.

Parameters:
user - The user to update.
Returns:
true if the user's password can be updated.

canUpdateGroupMembershipForUser

boolean canUpdateGroupMembershipForUser(com.atlassian.crowd.embedded.api.User user)
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.

Parameters:
user - The user to update.
Returns:
true if the user can be updated.

getAllGroups

Set<Group> getAllGroups()
Deprecated. Use getGroups(). Since v4.3

Returns all groups defined in JIRA.

Returns:
the set of all groups
Since:
v4.0

getGroups

Collection<com.atlassian.crowd.embedded.api.Group> getGroups()
Returns all groups defined in JIRA.

Returns:
the set of all groups
Since:
v4.3

getGroup

Group getGroup(@Nullable
               String groupName)
Deprecated. Since v4.3. Use getGroupObject(String).

Returns a Group based on user name.

Parameters:
groupName - the user name of the group
Returns:
the Group object, or null if the user cannot be found including null groupName.
Since:
v4.0

getGroupObject

com.atlassian.crowd.embedded.api.Group getGroupObject(@Nullable
                                                      String groupName)
Returns a Group based on user name.

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

Parameters:
groupName - the user name of the group
Returns:
the Group object, or null if the user cannot be found including null groupName.
Since:
v4.3

getWritableDirectories

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

Returns:
an ordered list of directories that have "read-write" permission.

hasPasswordWritableDirectory

boolean hasPasswordWritableDirectory()
Returns true if any of the directories have permission to update user passwords, false if otherwise.

Returns:
true if any of the directories have permission to update user passwords, false if otherwise.

canDirectoryUpdateUserPassword

boolean canDirectoryUpdateUserPassword(com.atlassian.crowd.embedded.api.Directory directory)
Checks if the given directory is able to update user passwords.

Parameters:
directory -
Returns:
true if the directory can update user passwords, false if otherwise.

getDirectory

com.atlassian.crowd.embedded.api.Directory getDirectory(Long directoryId)


Copyright © 2002-2011 Atlassian. All Rights Reserved.