public class StructureAuth extends Object
This class manages the current authentication context assumed when accessing, managing
and updating Structure entities such as Structure
or StructureView
.
The context is local to the current thread.
By default, the context equals to JIRA's authentication context
.
It is possible to specify another user or disable security checks; see sudo(ApplicationUser, boolean, CallableE)
)
and sudo(CallableE)
.
Constructor and Description |
---|
StructureAuth() |
Modifier and Type | Method and Description |
---|---|
static AuthContext |
currentContext() |
static ApplicationUser |
getUser()
Returns the current user.
|
static String |
getUserKey()
Returns
user key of the current user. |
static boolean |
isSecurityOverridden()
Returns
true if permission checks shouldn't be carried out in this context. |
static <R,E extends Exception> |
sudo(ApplicationUser user,
boolean overrideSecurity,
CallableE<R,E> f)
Execute actions with Structure under a different authentication context - as another user,
and/or with all security checks disabled.
|
static <R,E extends Exception> |
sudo(CallableE<R,E> f)
Execute actions with Structure under the current JIRA user with all security checks disabled.
|
@Nullable public static ApplicationUser getUser()
null
. "Override security" setting does not influence this method.@Nullable public static String getUserKey()
Returns user key
of the current user. If the user is not authenticated, i.e.
the context is anonymous, returns null
. "Override security" setting does not influence this method.
public static boolean isSecurityOverridden()
true
if permission checks shouldn't be carried out in this context.public static <R,E extends Exception> R sudo(@Nullable ApplicationUser user, boolean overrideSecurity, CallableE<R,E> f) throws E extends Exception
a shorthand override
user
- the user, can be null
to represent anonymousoverrideSecurity
- if true, user access level will not be checked for f
f
- the code to execute, this method will return the computed value.
Can throw E
, it will be propagated.E extends Exception
public static <R,E extends Exception> R sudo(CallableE<R,E> f) throws E extends Exception
f
- the code to execute, this method will return the computed value.
Can throw E
, it will be propagated.E extends Exception
public static AuthContext currentContext()
Copyright © 2024 Tempo Software. All Rights Reserved.