code: public boolean hasPermission(AccessControlList acl, String[] permission, Identity user)
     {
  
        String userId = user.getUserId();
  
        if (userId.equals(IdentityConstants.SYSTEM))
        {
           // SYSTEM has permission everywhere
           return true;
        }
        else if (userId.equals(acl.getOwner()))
        {
           // Current user is owner of node so has all privileges
           return true;
        }
        else if (userId.equals(IdentityConstants.ANONIM))
        {
           List<String> anyPermissions = acl.getPermissions(IdentityConstants.ANY);
  
           if (anyPermissions.size() < permission.length)
              return false;
  
           for (int i = 0; i < permission.length; i++)
           {
              if (!anyPermissions.contains(permission[i]))
                 return false;
           }
  
           return true;
        }
        else
        {
  
           if (acl.getPermissionsSize() > 0 && permission.length > 0)
           {
              // check permission to perform all of the listed actions
              for (int i = 0; i < permission.length; i++)
              {
                 // check specific actions
                 if (!isPermissionMatch(acl.getPermissionsList(), permission[i], user))
                    return false;
              }
              return true;
           }
           return false;
  
        }
     }
docs: Has permission.
  
  @param acl
  access control list
  @param permission
  permissions array
  @param user
  user Identity
  @return boolean