|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.user.util.MockUserManager
public class MockUserManager
Really simple mock implementation
Constructor Summary | |
---|---|
MockUserManager()
|
Method Summary | |
---|---|
void |
addUser(com.atlassian.crowd.embedded.api.User user)
|
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<com.atlassian.crowd.embedded.api.Group> |
getAllGroups()
Returns all groups defined in JIRA. |
Set<com.atlassian.crowd.embedded.api.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)
|
com.atlassian.crowd.embedded.api.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. |
com.atlassian.crowd.embedded.api.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 |
hasGroupWritableDirectory()
Returns true if any of the directories have permission to update groups. |
boolean |
hasPasswordWritableDirectory()
Returns true if any of the directories have permission to update user passwords, false if otherwise. |
boolean |
hasWritableDirectory()
Returns true if at least one User Directory has "read-write" permission. |
void |
setGroupWritableDirectory(boolean groupWritableDirectory)
|
void |
setWritableDirectory(boolean writableDirectory)
|
void |
updateUser(com.atlassian.crowd.embedded.api.User user)
Updates the User . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockUserManager()
Method Detail |
---|
public int getTotalUserCount()
UserManager
getTotalUserCount
in interface UserManager
public Set<com.atlassian.crowd.embedded.api.User> getAllUsers()
UserManager
com.opensymphony.user.User
. This class
has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with
earlier versions.
getAllUsers
in interface UserManager
public com.atlassian.crowd.embedded.api.User getUser(@Nullable String userName)
UserManager
User
based on user name.
Warning: previous incarnations of this method returned com.opensymphony.user.User
. This class
has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with
earlier versions.
getUser
in interface UserManager
userName
- the user name of the user
public com.atlassian.crowd.embedded.api.User getUserObject(@Nullable String userName)
UserManager
User
based on user name.
Legacy synonym for UserManager.getUser(String)
.
getUserObject
in interface UserManager
userName
- the user name of the user
UserManager.getUser(String)
public com.atlassian.crowd.embedded.api.User findUserInDirectory(String userName, Long directoryId)
UserManager
User
based on user name and directoryId
findUserInDirectory
in interface UserManager
userName
- the user name of the userdirectoryId
- the Directory to look in
public com.atlassian.crowd.embedded.api.User getUserEvenWhenUnknown(String userName)
UserManager
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.
getUserEvenWhenUnknown
in interface UserManager
userName
- the user name of the user
public boolean canUpdateUser(com.atlassian.crowd.embedded.api.User user)
UserManager
If the "External user management" setting is on, then you cannot update the user.
canUpdateUser
in interface UserManager
user
- The user to update.
public void updateUser(com.atlassian.crowd.embedded.api.User user)
UserManager
User
. The user must have non-null names and email address.
updateUser
in interface UserManager
user
- The user to update.public boolean canUpdateUserPassword(com.atlassian.crowd.embedded.api.User user)
UserManager
If the "External user management", or "External password management" setting is on, then you cannot update the password.
canUpdateUserPassword
in interface UserManager
user
- The user to update.
public boolean canUpdateGroupMembershipForUser(com.atlassian.crowd.embedded.api.User user)
UserManager
canUpdateGroupMembershipForUser
in interface UserManager
user
- The user to update.
public Set<com.atlassian.crowd.embedded.api.Group> getAllGroups()
UserManager
com.opensymphony.user.User
. This class
has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with
earlier versions.
getAllGroups
in interface UserManager
public com.atlassian.crowd.embedded.api.Group getGroup(@Nullable String groupName)
UserManager
Group
based on user name.
Warning: previous incarnations of this method returned com.opensymphony.user.User
. This class
has now been removed from the JIRA API, meaning that the 5.0 version is not binary or source compatible with
earlier versions.
getGroup
in interface UserManager
groupName
- the user name of the group
public com.atlassian.crowd.embedded.api.Group getGroupObject(@Nullable String groupName)
UserManager
Group
based on user name.
Legacy synonym for UserManager.getGroup(String)
.
getGroupObject
in interface UserManager
groupName
- the user name of the group
UserManager.getGroup(String)
public List<com.atlassian.crowd.embedded.api.Directory> getWritableDirectories()
UserManager
getWritableDirectories
in interface UserManager
UserManager.hasWritableDirectory()
public boolean hasWritableDirectory()
UserManager
This is equivalent to:
getWritableDirectories().size() > 0
hasWritableDirectory
in interface UserManager
UserManager.getWritableDirectories()
,
UserManager.hasPasswordWritableDirectory()
,
UserManager.hasGroupWritableDirectory()
public void setWritableDirectory(boolean writableDirectory)
public boolean hasPasswordWritableDirectory()
UserManager
Note that this is not quite the same as UserManager.hasWritableDirectory()
because of "Internal with LDAP Authentication" directories.
These directories are generally read-write but passwords are read-only.
hasPasswordWritableDirectory
in interface UserManager
UserManager.hasWritableDirectory()
public boolean hasGroupWritableDirectory()
UserManager
Note that this will not always return the same results as UserManager.hasWritableDirectory()
because you can set "Read-Only with Local Groups" to LDAP directories.
These directories are generally read-only but you can create local gropus and assign users to them.
hasGroupWritableDirectory
in interface UserManager
UserManager.hasWritableDirectory()
public void setGroupWritableDirectory(boolean groupWritableDirectory)
public boolean canDirectoryUpdateUserPassword(com.atlassian.crowd.embedded.api.Directory directory)
UserManager
canDirectoryUpdateUserPassword
in interface UserManager
directory
- the Directory
public com.atlassian.crowd.embedded.api.Directory getDirectory(Long directoryId)
getDirectory
in interface UserManager
public Collection<com.atlassian.crowd.embedded.api.User> getUsers()
UserManager
UserManager.getAllUsers()
.
getUsers
in interface UserManager
UserManager.getAllUsers()
public Collection<com.atlassian.crowd.embedded.api.Group> getGroups()
UserManager
UserManager.getAllGroups()
.
getGroups
in interface UserManager
UserManager.getAllGroups()
public void addUser(com.atlassian.crowd.embedded.api.User user)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |