Search in sources :

Example 1 with CapabilityService

use of org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService in project records-management by Alfresco.

the class ScriptRecordsManagmentNode method hasCapability.

public boolean hasCapability(String capabilityName) {
    boolean result = false;
    CapabilityService capabilityService = (CapabilityService) rmServices.getCapabilityService();
    Capability capability = capabilityService.getCapability(capabilityName);
    if (capability != null) {
        Map<Capability, AccessStatus> map = capabilityService.getCapabilitiesAccessState(nodeRef, Collections.singletonList(capabilityName));
        if (map.containsKey(capability)) {
            AccessStatus accessStatus = map.get(capability);
            if (!accessStatus.equals(AccessStatus.DENIED)) {
                result = true;
            }
        }
    }
    return result;
}
Also used : CapabilityService(org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService) Capability(org.alfresco.module.org_alfresco_module_rm.capability.Capability) AccessStatus(org.alfresco.service.cmr.security.AccessStatus)

Aggregations

Capability (org.alfresco.module.org_alfresco_module_rm.capability.Capability)1 CapabilityService (org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService)1 AccessStatus (org.alfresco.service.cmr.security.AccessStatus)1