public interface

UserManager

com.atlassian.sal.api.user.UserManager

Class Overview

Interface providing user based operations across various apps.

Summary

Public Methods
abstract boolean authenticate(String username, String password)
Given a usernamen & password, this method checks whether or not the provided user can be authenticated
abstract String getRemoteUsername()
Returns the username of the currently logged in user or null if no user can be found.
abstract String getRemoteUsername(HttpServletRequest request)
Returns the username of the currently logged in user or null if no user can be found.
abstract UserProfile getUserProfile(String username)
Returns a UserProfile object for the specified user or null if no user can be found
abstract boolean isAdmin(String username)
Returns true or false depending on whether a user has been granted the administrator permission.
abstract boolean isSystemAdmin(String username)
Returns true or false depending on whether a user has been granted the system administrator permission.
abstract boolean isUserInGroup(String username, String group)
Returns whether the user is in the specify group
abstract Principal resolve(String username)
Returns the user that made this request or null if this application does not have such a user.

Public Methods

public abstract boolean authenticate (String username, String password)

Given a usernamen & password, this method checks whether or not the provided user can be authenticated

Parameters
username Username of the user
password Password of the user
Returns
  • true if the user can be authenticated, false otherwise

public abstract String getRemoteUsername ()

Returns the username of the currently logged in user or null if no user can be found. If possible, please use getRemoteUsername(HttpServletRequest).

Returns
  • The user name of the logged in user or null

public abstract String getRemoteUsername (HttpServletRequest request)

Returns the username of the currently logged in user or null if no user can be found.

Parameters
request The request to retrieve the username from
Returns
  • The user name of the logged in user or null

public abstract UserProfile getUserProfile (String username)

Returns a UserProfile object for 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

public abstract boolean isAdmin (String username)

Returns true or false depending 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 check isSystemAdmin(String) instead.

Note that system administrator permission implies administrator permission. That is, any username for which userManager.isSystemAdmin(username) returns true will also return true for userManager.isAdmin(username).
Parameters
username The username of the user to check
Returns
  • true or false depending on whether the user has been granted the admin permission

public abstract boolean isSystemAdmin (String username)

Returns true or false depending 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 use isAdmin(String) instead.

Parameters
username The username of the user to check
Returns
  • true or false depending on whether a user has been granted the system admin permission.

public abstract boolean isUserInGroup (String username, String group)

Returns whether the user is in the specify group

Parameters
username The username to check
group The group to check
Returns
  • true if the user is in the specified group

public abstract Principal resolve (String username)

Returns the user that made this request or null if this application does not have such a user.

Parameters
username Username of the user a consumer is making a request on behalf of
Returns
  • Principal corresponding to the username, null if 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