diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties index 701dae81e6..a8fbf50130 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties @@ -13,7 +13,7 @@ log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info # Set to 'debug' to see details of capability failures when AccessDenied is thrown. May be # removed to enhance performance. # -log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor=debug +log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor=info # # RM permission debug diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java index 5a60bf1994..8e38d62e00 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java @@ -149,8 +149,11 @@ public class RMSecurityCommon implements ApplicationContextAware protected int getTransactionCache(String prefix, NodeRef nodeRef) { int result = NOSET_VALUE; - String user = AuthenticationUtil.getRunAsUser(); - Integer value = (Integer)AlfrescoTransactionSupport.getResource(prefix + nodeRef.toString() + user); + StringBuffer key = new StringBuffer(prefix) + .append(nodeRef) + .append(AuthenticationUtil.getRunAsUser()); + + Integer value = (Integer)AlfrescoTransactionSupport.getResource(key); if (value != null) { result = value.intValue(); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java index 7f4c4f97e4..0e920f8e69 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java @@ -29,9 +29,12 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; +import net.sf.acegisecurity.vote.AccessDecisionVoter; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability; import org.alfresco.module.org_alfresco_module_rm.capability.Capability; @@ -44,8 +47,6 @@ import org.alfresco.service.cmr.security.AccessStatus; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - /** * Declarative capability implementation. * @@ -70,6 +71,9 @@ public class DeclarativeCapability extends AbstractCapability /** Indicates whether to return an undetermined result */ protected boolean isUndetermined = false; + + /** List of available kinds */ + private Set availableKinds; /** * @param permissions permissions @@ -258,6 +262,27 @@ public class DeclarativeCapability extends AbstractCapability { return checkConditions(nodeRef, conditions); } + + /** + * Get list of available kinds + * + * @return list of available kinds + */ + + private Set getAvailableKinds() + { + if (kinds != null && availableKinds == null) + { + availableKinds = new HashSet(kinds.size()); + for (String kindString : kinds) + { + FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString); + availableKinds.add(kind); + } + } + + return availableKinds; + } /** * Checks that the node ref is of the expected kind @@ -273,23 +298,9 @@ public class DeclarativeCapability extends AbstractCapability if (actualKind != null) { - if (kinds != null && !kinds.isEmpty()) + Set availableKinds = getAvailableKinds(); + if (availableKinds == null || availableKinds.contains(actualKind)) { - // need to check the actual file plan kind is in the list specified - for (String kindString : kinds) - { - FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString); - if (actualKind.equals(kind)) - { - result = true; - break; - } - } - } - else - { - // we don't have any specific kinds to check, so we pass since we have a file - // plan component in our hands result = true; } }