Class SecurityAuthorizationScriptService
- java.lang.Object
-
- org.xwiki.security.authorization.script.SecurityAuthorizationScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("security.authorization") @Singleton public class SecurityAuthorizationScriptService extends Object implements org.xwiki.script.service.ScriptService
Security Authorization Script Service.- Since:
- 6.1RC1
- Version:
- $Id: 67fda8ba1dee4760cc5d28cdcf33c193ed9ee435 $
-
-
Constructor Summary
Constructors Constructor Description SecurityAuthorizationScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkAccess(Right right)
Check if access identified byright
on the current entity is allowed in the current context.void
checkAccess(Right right, org.xwiki.model.reference.DocumentReference userReference, org.xwiki.model.reference.EntityReference entityReference)
Check if the user identified byuserReference
has the access identified byright
on the entity identified byentityReference
.void
checkAccess(Right right, org.xwiki.model.reference.EntityReference entityReference)
Check if access identified byright
on the given entity is allowed in the current context.List<String>
getAllRightsNames()
boolean
hasAccess(Right right)
Verifies if access identified byright
on the current entity would be allowed in the current context.boolean
hasAccess(Right right, org.xwiki.model.reference.DocumentReference userReference, org.xwiki.model.reference.EntityReference entityReference)
Verifies if the user identified byuserReference
has the access identified byright
on the entity identified byentityReference
.boolean
hasAccess(Right right, org.xwiki.model.reference.EntityReference entityReference)
Verifies if access identified byright
on the given entity would be allowed in the current context.boolean
isRightRegistered(String rightName)
Check that a specific right is registered or not.
-
-
-
Field Detail
-
ID
public static final String ID
The role hint of this component.- See Also:
- Constant Field Values
-
-
Method Detail
-
checkAccess
public void checkAccess(Right right) throws AccessDeniedException
Check if access identified byright
on the current entity is allowed in the current context. The context includes information like the authenticated user, the current macro being executed, the rendering context restriction, the dropping of rights by macro, etc... This function should be used at security checkpoint.- Parameters:
right
- the right needed for execution of the action- Throws:
AccessDeniedException
- if the action should be denied, which may also happen when an error occurs
-
hasAccess
public boolean hasAccess(Right right)
Verifies if access identified byright
on the current entity would be allowed in the current context. The context includes information like the authenticated user, the current macro being executed, the rendering context restriction, the dropping of rights by macro, etc... This function should be used for interface matters, usecheckAccess(org.xwiki.security.authorization.Right)
at security checkpoints.- Parameters:
right
- the right to check .- Returns:
true
if the user has the specified right on the entity,false
otherwise
-
checkAccess
public void checkAccess(Right right, org.xwiki.model.reference.EntityReference entityReference) throws AccessDeniedException
Check if access identified byright
on the given entity is allowed in the current context. The context includes information like the authenticated user, the current macro being executed, the rendering context restriction, the dropping of rights by macro, etc... This function should be used at security checkpoint.- Parameters:
right
- the right needed for execution of the actionentityReference
- the entity on which to check the right- Throws:
AccessDeniedException
- if the action should be denied, which may also happen when an error occurs
-
hasAccess
public boolean hasAccess(Right right, org.xwiki.model.reference.EntityReference entityReference)
Verifies if access identified byright
on the given entity would be allowed in the current context. The context includes information like the authenticated user, the current macro being executed, the rendering context restriction, the dropping of rights by macro, etc... This function should be used for interface matters, usecheckAccess(org.xwiki.security.authorization.Right)
at security checkpoints.- Parameters:
right
- the right to check.entityReference
- the entity on which to check the right- Returns:
true
if the user has the specified right on the entity,false
otherwise
-
checkAccess
public void checkAccess(Right right, org.xwiki.model.reference.DocumentReference userReference, org.xwiki.model.reference.EntityReference entityReference) throws AccessDeniedException
Check if the user identified byuserReference
has the access identified byright
on the entity identified byentityReference
. Note that some rights may be checked higher in hierarchy of the provided entity if such right is not enabled at lowest hierarchy level provided. This function should be used at security checkpoint.- Parameters:
right
- the right needed for execution of the actionuserReference
- the user to check the right forentityReference
- the entity on which to check the right- Throws:
AccessDeniedException
- if the action should be denied, which may also happen when an error occurs
-
hasAccess
public boolean hasAccess(Right right, org.xwiki.model.reference.DocumentReference userReference, org.xwiki.model.reference.EntityReference entityReference)
Verifies if the user identified byuserReference
has the access identified byright
on the entity identified byentityReference
. Note that some rights may be checked higher in hierarchy of the provided entity if such right is not enabled at lowest hierarchy level provided. This function should be used for interface matters, usecheckAccess(org.xwiki.security.authorization.Right)
at security checkpoints.- Parameters:
right
- the right to check .userReference
- the user to check the right forentityReference
- the entity on which to check the right- Returns:
true
if the user has the specified right on the entity,false
otherwise
-
isRightRegistered
public boolean isRightRegistered(String rightName)
Check that a specific right is registered or not.- Parameters:
rightName
- the name of the right to check for registration.- Returns:
true
only if the right name can be find.- Since:
- 12.7RC1
-
-