Search in sources :

Example 1 with PermissionPreProcessor

use of org.alfresco.repo.security.permissions.processor.PermissionPreProcessor in project records-management by Alfresco.

the class ExtendedPermissionServiceImpl method hasPermission.

/**
 * Override to deal with the possibility of hard coded permission checks in core code. Note: Eventually we need to
 * merge the RM permission model into the core to make this more robust.
 *
 * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#hasPermission(org.alfresco.service.cmr.repository.NodeRef,
 *      java.lang.String)
 */
@Override
public AccessStatus hasPermission(NodeRef nodeRef, String perm) {
    AccessStatus result = AccessStatus.UNDETERMINED;
    if (nodeService.exists(nodeRef)) {
        // permission pre-processors
        List<PermissionPreProcessor> preProcessors = permissionProcessorRegistry.getPermissionPreProcessors();
        for (PermissionPreProcessor preProcessor : preProcessors) {
            // pre process permission
            result = preProcessor.process(nodeRef, perm);
            // veto if denied
            if (AccessStatus.DENIED.equals(result)) {
                return result;
            }
        }
        // evaluate permission
        result = hasPermissionImpl(nodeRef, perm);
        // permission post-processors
        List<PermissionPostProcessor> postProcessors = permissionProcessorRegistry.getPermissionPostProcessors();
        for (PermissionPostProcessor postProcessor : postProcessors) {
            // post process permission
            result = postProcessor.process(result, nodeRef, perm, this.configuredReadPermissions, this.configuredFilePermissions);
        }
    }
    return result;
}
Also used : PermissionPostProcessor(org.alfresco.repo.security.permissions.processor.PermissionPostProcessor) PermissionPreProcessor(org.alfresco.repo.security.permissions.processor.PermissionPreProcessor) AccessStatus(org.alfresco.service.cmr.security.AccessStatus)

Aggregations

PermissionPostProcessor (org.alfresco.repo.security.permissions.processor.PermissionPostProcessor)1 PermissionPreProcessor (org.alfresco.repo.security.permissions.processor.PermissionPreProcessor)1 AccessStatus (org.alfresco.service.cmr.security.AccessStatus)1