ALF-3952 Fix - Search/Read Permissions Evaluation Performance

o hooked unit test into test suite
o aclReaders cache invalidation fixes

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21465 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Steven Glover
2010-07-28 16:08:22 +00:00
parent 3ffb67e824
commit 4523c82186
5 changed files with 14 additions and 26 deletions

View File

@@ -181,7 +181,6 @@ public class AVMPermissionsDaoComponentImpl extends AbstractPermissionsDaoCompon
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
aclDaoComponent.deleteAccessControlList(acl.getId());
}
readersCache.remove(acl.getId());
break;
case FIXED:
throw new IllegalStateException("Delete not supported for fixed permissions");

View File

@@ -77,8 +77,6 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
private AccessControlListDAO fDefaultACLDAO;
protected SimpleCache<Serializable, Set<String>> readersCache;
/** a uuid identifying this unique instance */
private String uuid;
@@ -96,14 +94,6 @@ 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
*/
@@ -367,7 +357,6 @@ 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;
}
}
@@ -420,7 +409,6 @@ 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;
}
@@ -439,12 +427,6 @@ 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);

View File

@@ -422,6 +422,7 @@ public class AclDAOImpl implements AclDAO
if (!acl.isLatest())
{
aclCache.remove(id);
readersCache.remove(id);
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
}
@@ -470,6 +471,7 @@ public class AclDAOImpl implements AclDAO
aclCrudDAO.updateAcl(acl);
}
aclCache.remove(id);
readersCache.remove(id);
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
}
else if ((acl.getAclChangeSetId() == getCurrentChangeSetId()) && (!requiresVersion) && (!acl.getRequiresVersion()))
@@ -508,6 +510,7 @@ public class AclDAOImpl implements AclDAO
aclCrudDAO.updateAcl(acl);
}
aclCache.remove(id);
readersCache.remove(id);
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
}
else
@@ -596,6 +599,7 @@ public class AclDAOImpl implements AclDAO
acl.setRequiresVersion(Boolean.FALSE);
aclCrudDAO.updateAcl(acl);
aclCache.remove(id);
readersCache.remove(id);
return new AclChangeImpl(id, created, acl.getAclType(), newAcl.getAclType());
}
}
@@ -802,6 +806,7 @@ public class AclDAOImpl implements AclDAO
aclCrudDAO.deleteAcl(aclId);
aclCache.remove(aclId);
readersCache.remove(aclId);
}
if (dbAcl.getAclType() == ACLType.SHARED)
{
@@ -819,6 +824,7 @@ public class AclDAOImpl implements AclDAO
aclCrudDAO.deleteAcl(aclId);
aclCache.remove(aclId);
readersCache.remove(aclId);
}
}
else
@@ -930,6 +936,7 @@ public class AclDAOImpl implements AclDAO
// remove the deleted acl from the cache
aclCache.remove(id);
readersCache.remove(id);
acls.add(new AclChangeImpl(id, null, acl.getAclType(), null));
return acls;
}
@@ -1260,6 +1267,7 @@ public class AclDAOImpl implements AclDAO
acl.setInherits(Boolean.TRUE);
aclCrudDAO.updateAcl(acl);
aclCache.remove(id);
readersCache.remove(id);
changes.add(new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType()));
return changes;
case SHARED:
@@ -1305,6 +1313,7 @@ public class AclDAOImpl implements AclDAO
acl.setInherits(Boolean.FALSE);
aclCrudDAO.updateAcl(acl);
aclCache.remove(id);
readersCache.remove(id);
changes.add(new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType()));
return changes;
case SHARED:
@@ -1338,6 +1347,7 @@ public class AclDAOImpl implements AclDAO
aclToCopy.setRequiresVersion(true);
aclCrudDAO.updateAcl(aclToCopy);
aclCache.remove(toCopy);
readersCache.remove(toCopy);
inheritedId = getInheritedAccessControlList(toCopy);
if ((inheritedId != null) && (!inheritedId.equals(toCopy)))
{
@@ -1345,6 +1355,7 @@ public class AclDAOImpl implements AclDAO
inheritedAcl.setRequiresVersion(true);
aclCrudDAO.updateAcl(inheritedAcl);
aclCache.remove(inheritedId);
readersCache.remove(inheritedId);
}
return toCopy;
case REDIRECT:

View File

@@ -33,6 +33,7 @@ import org.alfresco.repo.security.authority.SimpleAuthorityServiceTest;
import org.alfresco.repo.security.permissions.dynamic.LockOwnerDynamicAuthorityTest;
import org.alfresco.repo.security.permissions.impl.AclDaoComponentTest;
import org.alfresco.repo.security.permissions.impl.PermissionServiceTest;
import org.alfresco.repo.security.permissions.impl.ReadPermissionTest;
import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationTest;
import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterTest;
import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSetTest;
@@ -73,7 +74,8 @@ public class SecurityTestSuite extends TestSuite
// Note org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizerTest has its own context and runs on its own
// suite.addTestSuite(ChainingUserRegistrySynchronizerTest.class);
suite.addTestSuite(OwnableServiceTest.class);
suite.addTestSuite(ReadPermissionTest.class);
return suite;
}
}