|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<AuthenticatedUserImpersonator> com.atlassian.confluence.user.AuthenticatedUserImpersonator
public enum AuthenticatedUserImpersonator
Impersonates an authenticated user during the execution of the given callback.
The authenticated user is stored on a thread local variable
for the
HTTP workers
. This variable is, amongst other things, used to
determine the locale
for i18n
.
This behaviour makes sense for most cases. But if you want to e.g. render a Soy template for an email (on an HTTP
worker) ahead of being sent, you'd want to set the locale to the recipient's locale. If the recipient is unknown to
Confluence, you'd want the lookup to default to the site's locale
instead
of the sender's locale.
AuthenticatedUserThreadLocal
,
UserThreadLocalFilter
,
ConfluenceI18nResolver
,
com.atlassian.soy.impl.GetTextFunction
,
DefaultLocaleManager
Enum Constant Summary | |
---|---|
REQUEST_AGNOSTIC
Use this instance if you'd want the thread to be agnostic of the request cache
during the execution of the given callback. |
|
REQUEST_AWARE
Use this instance if you'd want the thread to be aware of the request cache
during the execution of the given callback. |
Method Summary | ||
---|---|---|
|
asAnonymousUser(java.util.concurrent.Callable<T> callback)
|
|
|
asUser(java.util.concurrent.Callable<T> callback,
com.atlassian.user.User user)
Impersonates the given user during the execution of the given callback. |
|
static AuthenticatedUserImpersonator |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
|
static AuthenticatedUserImpersonator[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final AuthenticatedUserImpersonator REQUEST_AWARE
request cache
during the execution of the given callback.
This would mean that the locale lookup
would fall back to
the Browser's locale
.
RequestCacheThreadLocal
,
RequestCacheThreadLocalFilter
public static final AuthenticatedUserImpersonator REQUEST_AGNOSTIC
request cache
during the execution of the given callback.
This would mean that the locale lookup
would fall back to the
the site's locale
.
RequestCacheThreadLocal
,
RequestCacheThreadLocalFilter
Method Detail |
---|
public static AuthenticatedUserImpersonator[] values()
for (AuthenticatedUserImpersonator c : AuthenticatedUserImpersonator.values()) System.out.println(c);
public static AuthenticatedUserImpersonator valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is nullpublic <T> T asAnonymousUser(java.util.concurrent.Callable<T> callback)
asUser(Callable, User)
public <T> T asUser(java.util.concurrent.Callable<T> callback, @Nullable com.atlassian.user.User user)
callback
- the callback to be executeduser
- the user to be impersonated
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |