com.atlassian.jira.user.util.UserManager |
![]() |
Clients of @PublicApi
can expect
that programs compiled against a given version will remain binary compatible with later versions of the
@PublicApi
as per each product's API policy as long as the client does not implement/extend
@PublicApi
interfaces or classes (refer to each product's API policy for the exact
guarantee---usually binary compatibility is guaranteed at least across minor versions).
@PublicApi
interfaces and classes are not designed to be implemented or extended by clients,
we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not
affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces
annotated with @PublicSpi
are safe to extend/implement).
Simple user utilities that do not require an implementation with too many dependencies.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
UserManager.UserState | The current state of a user with regard to the same username existing in other user directories. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Checks if the given directory is able to update user passwords.
| |||||||||||
Test if this user can be renamed.
| |||||||||||
Test if this user's group membership can be updated, i.e.
| |||||||||||
Test if this user can be updated, i.e.
| |||||||||||
Test if this user's password can be updated, i.e.
| |||||||||||
Creates a user in the specified directory (userDirectoryId).
| |||||||||||
Returns a
User based on user name and directoryId | |||||||||||
Generates a random password that can be used when the admin has entered a blank password.
| |||||||||||
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See
UserSearchService
| |||||||||||
This method is deprecated.
Since v7.0. Only retrieve the groups you really need. See
GroupPickerSearchService
| |||||||||||
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See
UserSearchService
| |||||||||||
Get the
Directory in which users will be created by default | |||||||||||
Returns a
Group based on user name. | |||||||||||
Returns a
Group based on user name. | |||||||||||
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See
GroupPickerSearchService
| |||||||||||
Returns the total number of users defined in JIRA, regardless of whether they are active or not.
| |||||||||||
This method is deprecated.
Use
getUserByKey(String) or getUserByName(String) instead. Since v6.0.
| |||||||||||
Returns a user based in id.
| |||||||||||
Returns an
ApplicationUser based on user key. | |||||||||||
Returns an
ApplicationUser based on user key. | |||||||||||
Returns an
ApplicationUser based on user name. | |||||||||||
Returns an
ApplicationUser based on user name. | |||||||||||
This method is deprecated.
Use
getUserByKeyEvenWhenUnknown(String) or getUserByNameEvenWhenUnknown(String) instead. Since v6.0.
| |||||||||||
Returns an identity of the user with the specified id.
| |||||||||||
Returns an identity of the user with the specified key.
| |||||||||||
Returns an identity of the user with the specified username.
| |||||||||||
This method is deprecated.
Use
getUserByKey(String) or getUserByName(String) instead. Since v6.0.
| |||||||||||
This convenience method is equivalent to
getUserState(user.getUsername(), user.getDirectoryId())
except that a null user is permitted and returns INVALID_USER . | |||||||||||
Checks for the existence of this user across all directories to determine
whether or not the user exists in the specified directory and whether or not
it is shadowing or shadowed by a user with the same username in another
active user directory.
| |||||||||||
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See
UserSearchService
| |||||||||||
Returns an ordered list of directories that have "read-write" permission.
| |||||||||||
Returns true if any of the directories have permission to update groups.
| |||||||||||
Returns true if any of the directories have permission to update user passwords, false if otherwise.
| |||||||||||
Returns true if at least one User Directory has "read-write" permission.
| |||||||||||
Checks if given user is existing user
| |||||||||||
Updates the
ApplicationUser . | |||||||||||
Check if this user is allowed to update their own user details.
|
Checks if the given directory is able to update user passwords.
directory | the Directory |
---|
Test if this user can be renamed. In addition to the constraints of canUpdateUser(ApplicationUser)
,
renaming a user is only allowed when:
INTERNAL
or DELEGATING
user directory;
ANDJIRA_OPTION_USER_CROWD_ALLOW_RENAME
is enabled to bypass this check.user | The user to rename. |
---|
null
and can be renamed.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.
user | The user to update. |
---|
null
and can be updated.
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.
user | The user to update. |
---|
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.
user | The user to update. |
---|
null
and the user's password can be updated.
@Internal
or @PublicApi
.
Creates a user in the specified directory (userDirectoryId). If the directory is none()
,
the user is created in the default directory (usually an Embedded Crowd internal directory).
userData | the user request containing user details. |
---|
CreateException | unable to create user. |
---|---|
PermissionException | unable to create user due to permission error. |
Returns a User
based on user name and directoryId
userName | the user name of the user |
---|---|
directoryId | the Directory to look in |
Generates a random password that can be used when the admin has entered a blank password.
The password is guaranteed to contain at least one upper-case letter, lower-case letter and number in case the backend user Directory has password restrictions.
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See UserSearchService
Returns all users defined in JIRA, regardless of whether they are active or not.
This method is deprecated.
Since v7.0. Only retrieve the groups you really need. See GroupPickerSearchService
Returns all groups defined in JIRA.
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.
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See UserSearchService
Returns all users defined in JIRA, regardless of whether they are active or not.
Returns a 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.
groupName | the user name of the group |
---|
Returns a Group
based on user name.
Legacy synonym for getGroup(String)
.
groupName | the user name of the group |
---|
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See GroupPickerSearchService
Returns all groups defined in JIRA.
Legacy synonym for getAllGroups()
.
Returns the total number of users defined in JIRA, regardless of whether they are active or not.
This method is deprecated.
Use getUserByKey(String)
or getUserByName(String)
instead. Since v6.0.
Returns a User
based on user name.
userName | the user name of the user |
---|
Returns a user based in id.
id | user id |
---|
Returns an ApplicationUser
based on user key.
userKey | the key of the user |
---|
Returns an ApplicationUser
based on user key.
If you want to check if given user is known user - please use isUserExisting(com.atlassian.jira.user.ApplicationUser)
userKey | the key of the user |
---|
Returns an ApplicationUser
based on user name.
userName | the user name of the user |
---|
IllegalStateException | if the CrowdService
is able to resolve userName to a User , but the
UserKeyService does not have a key mapped for it.
This is not a valid configuration. |
---|
Returns an ApplicationUser
based on user name.
If you want to check if given user is known user - please use isUserExisting(com.atlassian.jira.user.ApplicationUser)
userName | the user name of the user |
---|
IllegalStateException | if the CrowdService
is able to resolve userName to a User , but the
UserKeyService does not have a key mapped for it.
This is not a valid configuration. |
---|
This method is deprecated.
Use getUserByKeyEvenWhenUnknown(String)
or getUserByNameEvenWhenUnknown(String)
instead. Since v6.0.
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.
userName | the user name of the user |
---|
Returns an identity of the user with the specified id.
id | user id |
---|
Returns an identity of the user with the specified key.
key | user key |
---|
Returns an identity of the user with the specified username.
username | user name |
---|
This method is deprecated.
Use getUserByKey(String)
or getUserByName(String)
instead. Since v6.0.
Returns a User
based on user name.
userName | the user name of the user |
---|
@Internal
or @PublicApi
.
This convenience method is equivalent to
getUserState(user.getUsername(), user.getDirectoryId())
except that a null
user is permitted and returns INVALID_USER
.
user | the user to check |
---|
@Internal
or @PublicApi
.
Checks for the existence of this user across all directories to determine whether or not the user exists in the specified directory and whether or not it is shadowing or shadowed by a user with the same username in another active user directory.
username | the username to check |
---|---|
directoryId | the directory ID of the user directory that the user came from |
This method is deprecated.
Since v7.0. Only retrieve the users you really need. See UserSearchService
Returns all users defined in JIRA, regardless of whether they are active or not.
Legacy synonym for getAllUsers()
.
Returns an ordered list of directories that have "read-write" permission. ie those directories that we can add a user to.
Returns true if any of the directories have permission to update groups.
Note that this will not always return the same results as 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.
Returns true if any of the directories have permission to update user passwords, false if otherwise.
Note that this is not quite the same as hasWritableDirectory()
because of "Internal with LDAP Authentication" directories.
These directories are generally read-write but passwords are read-only.
Returns true if at least one User Directory has "read-write" permission.
This is equivalent to:
getWritableDirectories().size() > 0
Checks if given user is existing user
user | possible existing user object - i.e. recieved from getUserByKeyEvenWhenUnknown(String) or getUserByNameEvenWhenUnknown(String) |
---|
true
if given user is real user, false
otherwise (also when given object is null
)Updates the ApplicationUser
. The user must have non-null names and email address. If the user's name
does not match the name that is currently associated with the key
, then
this is implicitly treated as a request to rename the user.
user | The user to update. |
---|
UserNotFoundException | If the supplied user does not exist in the directory . |
---|---|
OperationFailedException | If the underlying directory implementation failed to execute the operation. |
IllegalArgumentException | If something is wrong with the provided user object |
@Internal
or @PublicApi
.
Check if this user is allowed to update their own user details.
Returns true if the given user is in a read-write directory AND the "External user management" setting is off.
user | The user |
---|