mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-314: Records Management Administrator can't access FilePlan
* needed to check the capability, not the read permission * added helper method to capability service when checking a single capability git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0@36663 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
class="org.alfresco.module.org_alfresco_module_rm.jscript.app.JSONConversionComponent"
|
||||
parent="baseJsonConversionComponent">
|
||||
<property name="recordsManagementService" ref="RecordsManagementService"/>
|
||||
<property name="capabilityService" ref="CapabilityService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jsonConversionComponent.baseEvaluator"
|
||||
|
@@ -86,4 +86,13 @@ public interface CapabilityService
|
||||
* @return
|
||||
*/
|
||||
Map<Capability, AccessStatus> getCapabilitiesAccessState(NodeRef nodeRef, List<String> capabilityNames);
|
||||
|
||||
/**
|
||||
* Helper method to get the access state for a single capability.
|
||||
*
|
||||
* @param nodeRef
|
||||
* @param capabilityName
|
||||
* @return
|
||||
*/
|
||||
AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName);
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.capability;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -137,4 +138,21 @@ public class CapabilityServiceImpl implements CapabilityService
|
||||
return answer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilityAccessState(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName)
|
||||
{
|
||||
AccessStatus result = AccessStatus.UNDETERMINED;
|
||||
Capability capability = getCapability(capabilityName);
|
||||
if (capability != null)
|
||||
{
|
||||
List<String> list = Collections.singletonList(capabilityName);
|
||||
Map<Capability, AccessStatus> map = getCapabilitiesAccessState(nodeRef, list);
|
||||
result = map.get(capability);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -40,6 +41,9 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
||||
/** Records management service */
|
||||
private RecordsManagementService recordsManagementService;
|
||||
|
||||
/** Capability service */
|
||||
private CapabilityService capabilityService;
|
||||
|
||||
/** Indicators */
|
||||
private List<BaseEvaluator> indicators = new ArrayList<BaseEvaluator>();
|
||||
|
||||
@@ -54,6 +58,14 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
||||
this.recordsManagementService = recordsManagementService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param capabilityService capability service
|
||||
*/
|
||||
public void setCapabilityService(CapabilityService capabilityService)
|
||||
{
|
||||
this.capabilityService = capabilityService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param indicator registered indicator
|
||||
*/
|
||||
@@ -83,7 +95,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
||||
// Get the node reference for convenience
|
||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||
|
||||
if (AccessStatus.ALLOWED.equals(permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS)) == true)
|
||||
if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef, RMPermissionModel.VIEW_RECORDS)) == true)
|
||||
{
|
||||
// Indicate whether the node is a RM object or not
|
||||
boolean isFilePlanComponent = recordsManagementService.isFilePlanComponent(nodeInfo.getNodeRef());
|
||||
|
Reference in New Issue
Block a user