mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge remote-tracking branch 'origin/master' into feature/RM-6645_ArchiveAndRestoreActionsInexistentInRMSite
This commit is contained in:
@@ -46,10 +46,10 @@ import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||
import org.alfresco.repo.search.SimpleResultSetMetaData;
|
||||
import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet;
|
||||
import org.alfresco.repo.search.impl.querymodel.QueryEngineResults;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.permissions.PermissionCheckCollection;
|
||||
import org.alfresco.repo.security.permissions.PermissionCheckValue;
|
||||
import org.alfresco.repo.security.permissions.PermissionCheckedCollection.PermissionCheckedCollectionMixin;
|
||||
@@ -80,8 +80,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
|
||||
private static final String AFTER_RM = "AFTER_RM";
|
||||
|
||||
private AuthenticationUtil authenticationUtil;
|
||||
private int maxPermissionChecks;
|
||||
|
||||
private long maxPermissionCheckTimeMillis;
|
||||
|
||||
public boolean supports(ConfigAttribute configAttribute)
|
||||
@@ -131,6 +131,16 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
this.maxPermissionCheckTimeMillis = maxPermissionCheckTimeMillis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the authentication util
|
||||
*
|
||||
* @param authenticationUtil The authentication util to set
|
||||
*/
|
||||
public void setAuthenticationUtil(AuthenticationUtil authenticationUtil)
|
||||
{
|
||||
this.authenticationUtil = authenticationUtil;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object returnedObject)
|
||||
{
|
||||
@@ -148,7 +158,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
}
|
||||
try
|
||||
{
|
||||
if (AuthenticationUtil.isRunAsUserTheSystemUser())
|
||||
if (authenticationUtil.isRunAsUserTheSystemUser())
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -564,6 +574,13 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
}
|
||||
}
|
||||
|
||||
if (maxSize != null)
|
||||
{
|
||||
LimitBy limitBy = returnedObject.length() > maxSize ? LimitBy.FINAL_SIZE : LimitBy.UNLIMITED;
|
||||
filteringResultSet.setResultSetMetaData(new SimpleResultSetMetaData(limitBy,
|
||||
PermissionEvaluationMode.EAGER, returnedObject.getResultSetMetaData().getSearchParameters()));
|
||||
}
|
||||
|
||||
filteringResultSet.setNumberFound(returnedObject.getNumberFound());
|
||||
|
||||
return filteringResultSet;
|
||||
|
@@ -26,8 +26,7 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.util;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -41,11 +40,12 @@ import org.alfresco.util.ParameterCheck;
|
||||
*/
|
||||
public class NodeTypeUtility
|
||||
{
|
||||
/** Static cache for results of types that are instances of other Alfresco types. */
|
||||
private static ConcurrentHashMap<String, Boolean> instanceOfCache = new ConcurrentHashMap<>();
|
||||
|
||||
/** Dictionary service */
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
private static Map<String, Boolean> instanceOfCache = new WeakHashMap<>();
|
||||
|
||||
/**
|
||||
* @param dictionaryService dictionary service
|
||||
*/
|
||||
@@ -66,24 +66,8 @@ public class NodeTypeUtility
|
||||
ParameterCheck.mandatory("className", className);
|
||||
ParameterCheck.mandatory("ofClassName", ofClassName);
|
||||
|
||||
boolean result = false;
|
||||
|
||||
String key = className.toString() + "|" + ofClassName.toString();
|
||||
if (instanceOfCache.containsKey(key))
|
||||
{
|
||||
result = instanceOfCache.get(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ofClassName.equals(className) ||
|
||||
dictionaryService.isSubClass(className, ofClassName))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
instanceOfCache.put(key, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return instanceOfCache.computeIfAbsent(key, k ->
|
||||
(ofClassName.equals(className) || dictionaryService.isSubClass(className, ofClassName)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user