Fix for ALF-3952 - Search/Read Permissions Evaluation Performance

Includes read permission evaluation optimisation, bulk loading of aspects

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21406 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Steven Glover
2010-07-26 12:44:30 +00:00
parent c5e0bf79ab
commit 5791f1e7fb
38 changed files with 3095 additions and 1774 deletions

View File

@@ -24,12 +24,14 @@
*/
package org.alfresco.repo.domain.permissions;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.repo.security.permissions.ACEType;
import org.alfresco.repo.security.permissions.ACLType;
import org.alfresco.repo.security.permissions.AccessControlEntry;
@@ -75,6 +77,8 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
private AccessControlListDAO fDefaultACLDAO;
protected SimpleCache<Serializable, Set<String>> readersCache;
/** a uuid identifying this unique instance */
private String uuid;
@@ -92,6 +96,14 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
this.aclDaoComponent = aclDaoComponent;
}
/**
* @param readersCache the readersCache to set
*/
public void setReadersCache(SimpleCache<Serializable, Set<String>> readersCache)
{
this.readersCache = readersCache;
}
/**
* Checks equality by type and uuid
*/
@@ -355,6 +367,7 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
pattern.setPosition(Integer.valueOf(0));
List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern);
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
readersCache.remove(acl.getId());
break;
}
}
@@ -407,6 +420,7 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
pattern.setPosition(Integer.valueOf(0));
List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern);
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
readersCache.remove(acl.getId());
break;
}
@@ -425,6 +439,12 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
}
if (report.getCreated() != null)
{
Acl acl = getAccessControlList(nodeRef);
if(acl != null)
{
readersCache.remove(acl.getId());
}
SimpleAccessControlEntry entry = new SimpleAccessControlEntry();
entry.setAuthority(authority);
entry.setPermission(permission);