protected internal virtual bool isResourceValidForPermission(PermissionCheck permissionCheck) { Resource[] permissionResources = permissionCheck.Permission.Types; Resource givenResource = permissionCheck.Resource; return(ResourceTypeUtil.resourceIsContainedInArray(givenResource.resourceType(), permissionResources)); }
/// <returns> the set of permission for the given authorization </returns> public static Permission[] getPermissions(Authorization authorization) { int resourceType = authorization.ResourceType; Permission[] permissionsByResourceType = ResourceTypeUtil.getPermissionsByResourceType(resourceType); return(authorization.getPermissions(permissionsByResourceType)); }
/// <summary> /// check whether the permissions' resources /// are compatible to the filtered resource parameter /// </summary> private bool containsIncompatibleResourceType() { if (queryByResourceType && queryByPermission) { Resource[] resources = resourcesIntersection.toArray(new Resource[resourcesIntersection.Count]); return(!ResourceTypeUtil.resourceIsContainedInArray(resourceType_Renamed, resources)); } return(false); }
public virtual void validateResourceCompatibility(AuthorizationEntity authorization) { int resourceType = authorization.ResourceType; ISet <Permission> permissionSet = authorization.CachedPermissions; foreach (Permission permission in permissionSet) { if (!ResourceTypeUtil.resourceIsContainedInArray(resourceType, permission.Types)) { throw LOG.invalidResourceForAuthorization(resourceType, permission.Name); } } }
public virtual bool isPermissionRevoked(Permission p) { if (org.camunda.bpm.engine.authorization.Authorization_Fields.AUTH_TYPE_GRANT == authorizationType) { throw LOG.permissionStateException("isPermissionRevoked", "GRANT"); } ensureNotNull("Authorization 'resourceType' cannot be null", "authorization.getResource()", resourceType); if (!ResourceTypeUtil.resourceIsContainedInArray(resourceType, p.Types)) { return(false); } return((permissions & p.Value) != p.Value); }