Interface UserContext
- All Superinterfaces:
RenderingContext
- All Known Implementing Classes:
DefaultUserContext,JiraUserContext
Represents current user context.
User context is unique by means of the username and locale and those values can be used to cache evaluations of methods that take this class as parameter (along with other parameters).
Given an unauthenticated request, all methods of this interface except for RenderingContext.getRequest() will return null
- Since:
- v5.0
-
Method Summary
Modifier and TypeMethodDescriptioncom.atlassian.sal.api.message.I18nResolverGet I18n resolver associated with the current user.Get locale associated with the current user.Name of the current user.booleanCheck whether there is an authenticated user.Methods inherited from interface com.atlassian.administration.quicksearch.spi.RenderingContext
getContextMap, getRequest
-
Method Details
-
getUsername
Name of the current user. If there is no authenticated user associated with the executing request, returnnull.- Returns:
- current user, or
nullif no user authenticated
-
isAuthenticated
boolean isAuthenticated()Check whether there is an authenticated user.- Returns:
true, if there is an authenticated user associated with the current request.
-
getLocale
Get locale associated with the current user. Default locale ifisAuthenticated()returnsfalse.- Returns:
- get user locale
-
getI18nResolver
@Nonnull com.atlassian.sal.api.message.I18nResolver getI18nResolver()Get I18n resolver associated with the current user. Default language resolver if no user associated with this context (isAuthenticated()returnsfalse).- Returns:
- i18n resolver
-