Class PermissionEvaluatorImpl<S,R>

java.lang.Object
org.craftercms.commons.security.permissions.impl.PermissionEvaluatorImpl<S,R>
All Implemented Interfaces:
PermissionEvaluator<S,R>

public class PermissionEvaluatorImpl<S,R> extends Object implements PermissionEvaluator<S,R>
Default implementation of PermissionEvaluator
Author:
avasquez
  • Field Details

  • Constructor Details

    • PermissionEvaluatorImpl

      public PermissionEvaluatorImpl()
  • Method Details

    • setSubjectResolver

      public void setSubjectResolver(SubjectResolver<S> subjectResolver)
    • setPermissionResolver

      public void setPermissionResolver(PermissionResolver<S,R> permissionResolver)
    • isAllowed

      public boolean isAllowed(R resource, String action) throws PermissionException
      Description copied from interface: PermissionEvaluator
      Checks if the current subject (according to SubjectResolver) is allowed to perform the specified action on the given resource.
      Specified by:
      isAllowed in interface PermissionEvaluator<S,R>
      Parameters:
      resource - the resource or ID/IDs of the resource whose permissions should be checked. If null, the global permission should be checked
      action - 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

      public boolean isAllowed(S subject, R resource, String action) throws PermissionException
      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 interface PermissionEvaluator<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 checked
      action - the action the subject wants to perform (not null)
      Returns:
      true if the subject is allowed to execute the action, false otherwise
      Throws:
      PermissionException