mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Transaction level cahcing of declarative capability evaluation
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.1.0.x@84421 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,8 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@@ -297,6 +299,15 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
{
|
{
|
||||||
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
|
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
|
||||||
|
|
||||||
|
// check transaction cache
|
||||||
|
Map<String, Integer> map = TransactionalResourceHelper.getMap("rm.declarativeCapability");
|
||||||
|
String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser();
|
||||||
|
if (map.containsKey(key))
|
||||||
|
{
|
||||||
|
result = map.get(key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Check we are dealing with a file plan component
|
// Check we are dealing with a file plan component
|
||||||
if (filePlanService.isFilePlanComponent(nodeRef) == true)
|
if (filePlanService.isFilePlanComponent(nodeRef) == true)
|
||||||
{
|
{
|
||||||
@@ -321,6 +332,10 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
logger.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString());
|
logger.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = evaluateImpl(nodeRef);
|
||||||
|
map.put(key, result);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user