Class PermissionEvaluatorImpl<S,R>
java.lang.Object
org.craftercms.commons.security.permissions.impl.PermissionEvaluatorImpl<S,R>
- All Implemented Interfaces:
PermissionEvaluator<S,R>
Default implementation of
PermissionEvaluator- Author:
- avasquez
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPermissionEvaluatorImpl(SubjectResolver<S> subjectResolver, PermissionResolver<S, R> permissionResolver) -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the current subject (according toSubjectResolver) is allowed to perform the specified action on the given resource.booleanChecks if the given subject is allowed to perform the specified action on the given resource
-
Field Details
-
subjectResolver
-
permissionResolver
-
-
Constructor Details
-
PermissionEvaluatorImpl
public PermissionEvaluatorImpl(SubjectResolver<S> subjectResolver, PermissionResolver<S, R> permissionResolver)
-
-
Method Details
-
isAllowed
Description copied from interface:PermissionEvaluatorChecks if the current subject (according toSubjectResolver) is allowed to perform the specified action on the given resource.- Specified by:
isAllowedin interfacePermissionEvaluator<S,R> - Parameters:
resource- the resource or ID/IDs of the resource whose permissions should be checked. If null, the global permission should be checkedaction- the action the subject wants to perform (not null)- Returns:
- true if the subject is allowed to execute the action, false otherwise
- Throws:
PermissionException
-
isAllowed
Description copied from interface:PermissionEvaluatorChecks if the given subject is allowed to perform the specified action on the given resource- Specified by:
isAllowedin interfacePermissionEvaluator<S,R> - Parameters:
subject- the subject (not null)resource- the resource or ID/IDs of the resource whose permissions should be checked. If null, the global permission should be checkedaction- the action the subject wants to perform (not null)- Returns:
- true if the subject is allowed to execute the action, false otherwise
- Throws:
PermissionException
-