mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Search browse performance improvements
(cherry picked from commit 089df63e27b03efbfb97c369faad80c8e8c9885c)
This commit is contained in:
@@ -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
|
# Set to 'debug' to see details of capability failures when AccessDenied is thrown. May be
|
||||||
# removed to enhance performance.
|
# 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
|
# RM permission debug
|
||||||
|
@@ -149,8 +149,11 @@ public class RMSecurityCommon implements ApplicationContextAware
|
|||||||
protected int getTransactionCache(String prefix, NodeRef nodeRef)
|
protected int getTransactionCache(String prefix, NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
int result = NOSET_VALUE;
|
int result = NOSET_VALUE;
|
||||||
String user = AuthenticationUtil.getRunAsUser();
|
StringBuffer key = new StringBuffer(prefix)
|
||||||
Integer value = (Integer)AlfrescoTransactionSupport.getResource(prefix + nodeRef.toString() + user);
|
.append(nodeRef)
|
||||||
|
.append(AuthenticationUtil.getRunAsUser());
|
||||||
|
|
||||||
|
Integer value = (Integer)AlfrescoTransactionSupport.getResource(key);
|
||||||
if (value != null)
|
if (value != null)
|
||||||
{
|
{
|
||||||
result = value.intValue();
|
result = value.intValue();
|
||||||
|
@@ -29,9 +29,12 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
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;
|
||||||
@@ -44,8 +47,6 @@ import org.alfresco.service.cmr.security.AccessStatus;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declarative capability implementation.
|
* Declarative capability implementation.
|
||||||
*
|
*
|
||||||
@@ -70,6 +71,9 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
|
|
||||||
/** Indicates whether to return an undetermined result */
|
/** Indicates whether to return an undetermined result */
|
||||||
protected boolean isUndetermined = false;
|
protected boolean isUndetermined = false;
|
||||||
|
|
||||||
|
/** List of available kinds */
|
||||||
|
private Set<FilePlanComponentKind> availableKinds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param permissions permissions
|
* @param permissions permissions
|
||||||
@@ -258,6 +262,27 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
{
|
{
|
||||||
return checkConditions(nodeRef, conditions);
|
return checkConditions(nodeRef, conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of available kinds
|
||||||
|
*
|
||||||
|
* @return list of available kinds
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Set<FilePlanComponentKind> getAvailableKinds()
|
||||||
|
{
|
||||||
|
if (kinds != null && availableKinds == null)
|
||||||
|
{
|
||||||
|
availableKinds = new HashSet<FilePlanComponentKind>(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
|
* Checks that the node ref is of the expected kind
|
||||||
@@ -273,23 +298,9 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
|
|
||||||
if (actualKind != null)
|
if (actualKind != null)
|
||||||
{
|
{
|
||||||
if (kinds != null && !kinds.isEmpty())
|
Set<FilePlanComponentKind> 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;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user