mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'hotfix-2.5/MNT-18083-SearchPerf250x' into 'release/V2.5.0.x'
Hotfix 2.5/mnt 18083 search perf250x See merge request !370
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
|
||||||
|
@@ -35,9 +35,10 @@
|
|||||||
<property name="nodeService" ref="NodeService"/>
|
<property name="nodeService" ref="NodeService"/>
|
||||||
<property name="namespaceService" ref="NamespaceService"/>
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
<property name="capabilityService" ref="CapabilityService"/>
|
<property name="capabilityService" ref="CapabilityService"/>
|
||||||
<property name="filePlanService" ref="FilePlanService" />
|
<property name="filePlanService" ref="filePlanService" />
|
||||||
<property name="dispositionService" ref="DispositionService" />
|
<property name="dispositionService" ref="DispositionService" />
|
||||||
<property name="recordFolderService" ref="RecordFolderService" />
|
<property name="recordFolderService" ref="RecordFolderService" />
|
||||||
|
<property name="transactionalResourceHelper" ref="rm.transactionalResourceHelper" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="jsonConversionComponent.baseIndicator"
|
<bean id="jsonConversionComponent.baseIndicator"
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,20 +40,26 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.springframework.beans.factory.BeanNameAware;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base evaluator.
|
* Base evaluator.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public abstract class BaseEvaluator implements RecordsManagementModel
|
public abstract class BaseEvaluator implements RecordsManagementModel, BeanNameAware
|
||||||
{
|
{
|
||||||
/** Name */
|
/** Name */
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
|
/** bean name */
|
||||||
|
protected String beanName;
|
||||||
|
|
||||||
/** JSON conversion component */
|
/** JSON conversion component */
|
||||||
protected JSONConversionComponent jsonConversionComponent;
|
protected JSONConversionComponent jsonConversionComponent;
|
||||||
@@ -84,7 +90,19 @@ public abstract class BaseEvaluator implements RecordsManagementModel
|
|||||||
|
|
||||||
/** Record folder service */
|
/** Record folder service */
|
||||||
protected RecordFolderService recordFolderService;
|
protected RecordFolderService recordFolderService;
|
||||||
|
|
||||||
|
/** transactional resource helper */
|
||||||
|
protected TransactionalResourceHelper transactionalResourceHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param beanName bean name
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setBeanName(String beanName)
|
||||||
|
{
|
||||||
|
this.beanName = beanName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param jsonConversionComponent json conversion component
|
* @param jsonConversionComponent json conversion component
|
||||||
*/
|
*/
|
||||||
@@ -148,6 +166,14 @@ public abstract class BaseEvaluator implements RecordsManagementModel
|
|||||||
{
|
{
|
||||||
this.recordFolderService = recordFolderService;
|
this.recordFolderService = recordFolderService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param transactionalResourceHelper transactional resource helper
|
||||||
|
*/
|
||||||
|
public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper)
|
||||||
|
{
|
||||||
|
this.transactionalResourceHelper = transactionalResourceHelper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name
|
* @param name
|
||||||
@@ -217,17 +243,25 @@ public abstract class BaseEvaluator implements RecordsManagementModel
|
|||||||
*/
|
*/
|
||||||
public boolean evaluate(NodeRef nodeRef)
|
public boolean evaluate(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
boolean result = false;
|
Map<String, Boolean> results = transactionalResourceHelper.getMap("BaseEvaluator.evaluate");
|
||||||
|
String key = new StringBuffer(nodeRef.toString()).append(AuthenticationUtil.getRunAsUser()).append(beanName).toString();
|
||||||
// Check that we are dealing with the correct kind of RM object
|
|
||||||
if ((kinds == null || checkKinds(nodeRef)) &&
|
if (!results.containsKey(key))
|
||||||
// Check we have the required capabilities
|
|
||||||
(capabilities == null || checkCapabilities(nodeRef)))
|
|
||||||
{
|
{
|
||||||
result = evaluateImpl(nodeRef);
|
boolean result = false;
|
||||||
|
|
||||||
|
// Check that we are dealing with the correct kind of RM object
|
||||||
|
if ((kinds == null || checkKinds(nodeRef)) &&
|
||||||
|
// Check we have the required capabilities
|
||||||
|
(capabilities == null || checkCapabilities(nodeRef)))
|
||||||
|
{
|
||||||
|
result = evaluateImpl(nodeRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
results.put(key, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return results.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user