Class StructureAuth
Object
StructureAuth
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthContextstatic ApplicationUsergetUser()Returns the current user.static StringReturnsuser keyof the current user.static booleanReturnstrueif permission checks shouldn't be carried out in this context.static <R,E extends Exception>
RExecute actions with Structure under the current JIRA user with all security checks disabled.static <R,E extends Exception>
RExecute actions with Structure under a different authentication context - as another user, and/or with all security checks disabled.
-
Constructor Details
-
StructureAuth
public StructureAuth()
-
-
Method Details
-
getUser
@Nullable public static ApplicationUser getUser()Returns the current user. If the user is not authenticated, i.e. the context is anonymous, returnsnull. "Override security" setting does not influence this method.- Returns:
- the current user
-
getUserKey
Returns
user keyof the current user. If the user is not authenticated, i.e. the context is anonymous, returnsnull. "Override security" setting does not influence this method.- Returns:
- key of the current user
-
isSecurityOverridden
public static boolean isSecurityOverridden()Returnstrueif permission checks shouldn't be carried out in this context. -
sudo
public static <R,E extends Exception> R sudo(@Nullable ApplicationUser user, boolean overrideSecurity, CallableE<R, E> f) throws EExecute actions with Structure under a different authentication context - as another user, and/or with all security checks disabled. If you only need to override security while keeping user context intact, you can usea shorthand override- Parameters:
user- the user, can benullto represent anonymousoverrideSecurity- if true, user access level will not be checked forff- the code to execute, this method will return the computed value. Can throwStructureAuth, it will be propagated.- Throws:
E extends Exception
-
sudo
Execute actions with Structure under the current JIRA user with all security checks disabled.- Parameters:
f- the code to execute, this method will return the computed value. Can throwStructureAuth, it will be propagated.- Throws:
E extends Exception
-
currentContext
-