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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the current subject (according toSubjectResolver
) is allowed to perform the specified action on the given resource.boolean
Checks if the given subject is allowed to perform the specified action on the given resourcevoid
setPermissionResolver
(PermissionResolver<S, R> permissionResolver) void
setSubjectResolver
(SubjectResolver<S> subjectResolver)
-
Field Details
-
subjectResolver
-
permissionResolver
-
-
Constructor Details
-
PermissionEvaluatorImpl
public PermissionEvaluatorImpl()
-
-
Method Details
-
setSubjectResolver
-
setPermissionResolver
-
isAllowed
Description copied from interface:PermissionEvaluator
Checks if the current subject (according toSubjectResolver
) is allowed to perform the specified action on the given resource.- Specified by:
isAllowed
in 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:PermissionEvaluator
Checks if the given subject is allowed to perform the specified action on the given resource- Specified by:
isAllowed
in 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
-