Package com.atlassian.jira.user
Class UserUtils
java.lang.Object
com.atlassian.jira.user.UserUtils
A static helper class for User operations.
Normally you should use dependency injection to get hold of a UserManager or a UserUtil instance.
- Since:
- v4.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ApplicationUser
Retrieves and returns the user by given username.static ApplicationUser
getUserByEmail
(String emailAddress) Return the first user found that matches the given email address (or null if not found).static ApplicationUser
getUserEvenWhenUnknown
(String username) Returns aUser
based on user name.static UserManager
static List<ApplicationUser>
getUsersByEmail
(String email) Finds the users by the given e-mail address.static boolean
userExists
(String username) Checks if a user with given username exists.
-
Constructor Details
-
UserUtils
public UserUtils()
-
-
Method Details
-
userExists
Checks if a user with given username exists. Returns true if such user exists, false otherwise.- Parameters:
username
- username to look up- Returns:
- true if user found, false otherwise
-
getUser
Retrieves and returns the user by given username.- Parameters:
username
- the username to get- Returns:
- user or null if not found
-
getUserEvenWhenUnknown
Returns aUser
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.4
-
getUserByEmail
Return the first user found that matches the given email address (or null if not found).The email address is matched case insensitive.
- Parameters:
emailAddress
- user email address- Returns:
- The first user that matches the email address or null if not found or the given email address is null.
-
getUsersByEmail
Finds the users by the given e-mail address. E-mail address look-up is done case insensitively. Leading or trailing spaces in the given e-mail address are trimmed before look up.- Parameters:
email
- e-mail address- Returns:
- always returns a list of users found (even if empty)
-
getUserManager
-