Interface UserManager
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(String username, String password) Given a username and password, this method checks whether the provided user can be authenticatedfindGroupNamesByPrefix(String prefix, int startIndex, int maxResults) Returns a list of group names.Returns the profile of the currently logged in user or null if no user can be found.getRemoteUser(javax.servlet.http.HttpServletRequest request) Returns theUserProfileof the currently logged in user or null if no user can be found.Returns the key of the currently logged in user or null if no user can be found.getRemoteUserKey(javax.servlet.http.HttpServletRequest request) Returns theUserKeyof the currently logged in user or null if no user can be found.Deprecated.getRemoteUsername(javax.servlet.http.HttpServletRequest request) Deprecated.since 2.10, usegetRemoteUser(javax.servlet.http.HttpServletRequest)instead.getUserProfile(UserKey userKey) Returns aUserProfile objectfor the specified user or null if no user can be foundgetUserProfile(String username) Returns aUserProfile objectfor the specified user or null if no user can be foundbooleanReturnstrueorfalsedepending on whether a user has been granted the administrator permission.booleanDeprecated.since 2.10, useisAdmin(UserKey)insteadbooleanReturns whether the site is configured to allow access for anonymous users.booleanisLicensed(UserKey userKey) Returns whether user has been assigned one or more product licenses.booleanReturns whether the site is configured to allow limited access for unlicensed users.default booleanisLimitedUnlicensedUser(UserKey userKey) Returns whether user is not disabled AND is unlicensed AND site has enabled limited unlicensed access (seeisLimitedUnlicensedAccessEnabled())booleanisSystemAdmin(UserKey userKey) Returnstrueorfalsedepending on whether a user has been granted the system administrator permission.booleanisSystemAdmin(String username) Deprecated.since 2.10, useisSystemAdmin(UserKey)insteadbooleanisUserInGroup(UserKey userKey, String group) Returns whether the given user is in the given groupbooleanisUserInGroup(String username, String group) Deprecated.since 2.10, useisUserInGroup(UserKey, String)insteadReturns the user that made this request ornullif this application does not have such a user.
-
Method Details
-
getRemoteUsername
Deprecated.since 2.10, usegetRemoteUser()orgetRemoteUserKey()insteadReturns the username of the currently logged in user or null if no user can be found. If possible, please usegetRemoteUsername(HttpServletRequest).- Returns:
- The user name of the logged in user or null
-
getRemoteUser
Returns the profile of the currently logged in user or null if no user can be found.Getting the full
UserProfilemay have performance implications in some applications. Consider usinggetRemoteUserKey()if you don't need the full object.- Returns:
- the
UserProfileof the logged in user or null - Since:
- 2.10
- See Also:
-
getRemoteUserKey
Returns the key of the currently logged in user or null if no user can be found.- Returns:
- the
UserKeyof the logged in user or null - Since:
- 2.10
- See Also:
-
getRemoteUsername
Deprecated.since 2.10, usegetRemoteUser(javax.servlet.http.HttpServletRequest)instead.Returns the username of the currently logged in user or null if no user can be found.* Note: Implementing applications might not actually be using the
HttpServletRequest, but actually using an internalThreadLocalauthentication context.- Parameters:
request- The request to retrieve the username from- Returns:
- The user name of the logged in user or null
-
getRemoteUser
Returns theUserProfileof the currently logged in user or null if no user can be found.Getting the full
UserProfilemay have performance implications in some applications. Consider usinggetRemoteUserKey()if you don't need the full object.* Note: Implementing applications might not actually be using the
HttpServletRequest, but actually using an internalThreadLocalauthentication context.- Parameters:
request- The request to retrieve the username from- Returns:
- The currently logged in user or null
- Since:
- 2.10
- See Also:
-
getRemoteUserKey
Returns theUserKeyof the currently logged in user or null if no user can be found.Note: Implementing applications might not actually be using the
HttpServletRequest, but actually using an internalThreadLocalauthentication context.- Parameters:
request- The request to retrieve the username from- Returns:
- The key of the currently logged in user or null
- Since:
- 2.10
- See Also:
-
getUserProfile
Returns aUserProfile objectfor the specified user or null if no user can be found- Parameters:
username- The username of the user whose profile is requested- Returns:
- The user's profile or null
- Since:
- 2.2.0
-
getUserProfile
Returns aUserProfile objectfor the specified user or null if no user can be found- Parameters:
userKey- The userKey of the user whose profile is requested- Returns:
- The user's profile or null
- Since:
- 2.10
-
isUserInGroup
Deprecated.since 2.10, useisUserInGroup(UserKey, String)insteadReturns whether the user is in the specify group- Parameters:
username- The username to checkgroup- The group to check- Returns:
trueif the user is in the specified group
-
isUserInGroup
Returns whether the given user is in the given group- Parameters:
userKey- The usergroup- The group- Returns:
trueif the user is in the specified group- Since:
- 2.10
-
isSystemAdmin
Deprecated.since 2.10, useisSystemAdmin(UserKey)insteadReturnstrueorfalsedepending on whether a user has been granted the system administrator permission. A system administrator has full administrative permissions in the application, including permission to perform operations that may affect the underlying operating system, such as specifying filesystem paths, installing plugins, configuring mail servers and logging, performing backups and restores, etc. Only check for system administrator when performing this type of operation. Operations that do not affect the underlying system should useisAdmin(String)instead.- Parameters:
username- The username of the user to check- Returns:
trueorfalsedepending on whether a user has been granted the system admin permission.- See Also:
-
isSystemAdmin
Returnstrueorfalsedepending on whether a user has been granted the system administrator permission. A system administrator has full administrative permissions in the application, including permission to perform operations that may affect the underlying operating system, such as specifying filesystem paths, installing plugins, configuring mail servers and logging, performing backups and restores, etc. Only check for system administrator when performing this type of operation. Operations that do not affect the underlying system should useisAdmin(String)instead.- Parameters:
userKey- The key of the user to check- Returns:
trueorfalsedepending on whether a user has been granted the system admin permission.- Since:
- 2.10
- See Also:
-
isAdmin
Deprecated.since 2.10, useisAdmin(UserKey)insteadReturnstrueorfalsedepending on whether a user has been granted the administrator permission. An administrator may have restricted administrative permissions that only apply to application-level configuration that cannot affect the underlying operating system. Only check for administrator permission when performing this type of operation. Operations that can affect security, the filesystem, or allow arbitrary code execution must checkisSystemAdmin(String)instead.Note that system administrator permission implies administrator permission. That is, any username for which
userManager.isSystemAdmin(username)returnstruewill also returntrueforuserManager.isAdmin(username).- Parameters:
username- The username of the user to check- Returns:
trueorfalsedepending on whether the user has been granted the admin permission- See Also:
-
isAdmin
Returnstrueorfalsedepending on whether a user has been granted the administrator permission. An administrator may have restricted administrative permissions that only apply to application-level configuration that cannot affect the underlying operating system. Only check for administrator permission when performing this type of operation. Operations that can affect security, the filesystem, or allow arbitrary code execution must checkisSystemAdmin(String)instead.Note that system administrator permission implies administrator permission. That is, any username for which
userManager.isSystemAdmin(username)returnstruewill also returntrueforuserManager.isAdmin(username).- Parameters:
userKey- The user of the user to check- Returns:
trueorfalsedepending on whether the user has been granted the admin permission- Since:
- 2.10
- See Also:
-
isLicensed
Returns whether user has been assigned one or more product licenses.
As Bamboo does not assign user licenses, it will return true for any existing user.
- Parameters:
userKey- The key of the user to query- Returns:
trueorfalse
-
isLimitedUnlicensedUser
Returns whether user is not disabled AND is unlicensed AND site has enabled limited unlicensed access (see
isLimitedUnlicensedAccessEnabled())- Parameters:
userKey- The key of the user to query- Returns:
trueorfalse
-
authenticate
Given a username and password, this method checks whether the provided user can be authenticated- Parameters:
username- Username of the userpassword- Password of the user- Returns:
trueif the user can be authenticated,falseotherwise
-
resolve
Returns the user that made this request ornullif this application does not have such a user.- Parameters:
username- Username of the user a consumer is making a request on behalf of- Returns:
Principalcorresponding to the username,nullif the user does not exist- Throws:
UserResolutionException- thrown if there is a problem resolving the user, such as a failure when accessing an external user store
-
findGroupNamesByPrefix
Returns a list of group names.- Parameters:
prefix- only return groups with names matching this prefixstartIndex- don't return the first startIndex resultsmaxResults- return at most this many results- Returns:
- an Iterable of names of groups
-
isAnonymousAccessEnabled
boolean isAnonymousAccessEnabled()Returns whether the site is configured to allow access for anonymous users.- Returns:
trueorfalse
-
isLimitedUnlicensedAccessEnabled
boolean isLimitedUnlicensedAccessEnabled()Returns whether the site is configured to allow limited access for unlicensed users.
At the time of introduction of this API:
- Only Confluence and JSM are capable of enabling this option.
- Bamboo will return true as they do not assign user licenses.
- All other products will return false as they do not have a need to grant resource access specifically to unlicensed users.
See
isLimitedUnlicensedUser(com.atlassian.sal.api.user.UserKey)to query this in relation to a user.- Returns:
trueorfalse
-
getRemoteUser()orgetRemoteUserKey()instead