@PublicApi
public interface PermissionEnforcer
PermissionEnforcer takes all permissions into account from the current security context. This includes the
calling user's permissions, but also any permission escalations or restrictions that may be in effect (e.g.
read-only personal access tokens).
The host application ensures that any thrown AuthorisationException is handled correctly:
| Modifier and Type | Method and Description |
|---|---|
void |
enforceAdmin()
Verifies that the current security context has sufficient authorisation to perform administration tasks.
|
void |
enforceAuthenticated()
Verifies that the current user is authenticated.
|
void |
enforceSystemAdmin()
Verifies that the current security context has sufficient authorisation to perform system administration tasks.
|
boolean |
isAdmin()
Tests whether the current security context has sufficient authorisation to perform administration tasks.
|
boolean |
isAuthenticated() |
boolean |
isSystemAdmin()
Tests whether the current security context has sufficient authorisation to perform system administration tasks.
|
void enforceAdmin()
throws AuthorisationException
AuthorisationException - if the current security context lacks the required authorisationNotAuthenticatedException - if the current security context lacks the required authorisation and
the current user is not authenticatedvoid enforceAuthenticated()
throws NotAuthenticatedException
NotAuthenticatedException - if the user is not authenticatedvoid enforceSystemAdmin()
throws AuthorisationException
AuthorisationException - if the current security context lacks the required authorisationNotAuthenticatedException - if the current security context lacks the required authorisation and
the current user is not authenticatedboolean isAdmin()
true if the current security context has sufficient authorisation to perform administration
tasks, otherwise falseboolean isAuthenticated()
true if the current user is authenticatedboolean isSystemAdmin()
true if the current security context has sufficient authorisation to perform system
administration tasks, otherwise falseCopyright © 2019 Atlassian. All rights reserved.