mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -184,9 +184,6 @@
|
|||||||
<property name="aclDAO">
|
<property name="aclDAO">
|
||||||
<ref bean="aclDAO"/>
|
<ref bean="aclDAO"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="readersCache">
|
|
||||||
<ref bean="readersCache" />
|
|
||||||
</property>
|
|
||||||
<property name="protocolToACLDAO">
|
<property name="protocolToACLDAO">
|
||||||
<map>
|
<map>
|
||||||
<entry key="workspace"><ref bean="admNodeACLDAO"></ref></entry>
|
<entry key="workspace"><ref bean="admNodeACLDAO"></ref></entry>
|
||||||
@@ -202,9 +199,6 @@
|
|||||||
<property name="aclDAO">
|
<property name="aclDAO">
|
||||||
<ref bean="aclDAO"/>
|
<ref bean="aclDAO"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="readersCache">
|
|
||||||
<ref bean="readersCache" />
|
|
||||||
</property>
|
|
||||||
<property name="protocolToACLDAO">
|
<property name="protocolToACLDAO">
|
||||||
<map>
|
<map>
|
||||||
<entry key="workspace"><ref bean="admNodeACLDAO"></ref></entry>
|
<entry key="workspace"><ref bean="admNodeACLDAO"></ref></entry>
|
||||||
|
@@ -181,7 +181,6 @@ public class AVMPermissionsDaoComponentImpl extends AbstractPermissionsDaoCompon
|
|||||||
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
||||||
aclDaoComponent.deleteAccessControlList(acl.getId());
|
aclDaoComponent.deleteAccessControlList(acl.getId());
|
||||||
}
|
}
|
||||||
readersCache.remove(acl.getId());
|
|
||||||
break;
|
break;
|
||||||
case FIXED:
|
case FIXED:
|
||||||
throw new IllegalStateException("Delete not supported for fixed permissions");
|
throw new IllegalStateException("Delete not supported for fixed permissions");
|
||||||
|
@@ -77,8 +77,6 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
|
|||||||
|
|
||||||
private AccessControlListDAO fDefaultACLDAO;
|
private AccessControlListDAO fDefaultACLDAO;
|
||||||
|
|
||||||
protected SimpleCache<Serializable, Set<String>> readersCache;
|
|
||||||
|
|
||||||
/** a uuid identifying this unique instance */
|
/** a uuid identifying this unique instance */
|
||||||
private String uuid;
|
private String uuid;
|
||||||
|
|
||||||
@@ -96,14 +94,6 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
|
|||||||
this.aclDaoComponent = aclDaoComponent;
|
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
|
* Checks equality by type and uuid
|
||||||
*/
|
*/
|
||||||
@@ -367,7 +357,6 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
|
|||||||
pattern.setPosition(Integer.valueOf(0));
|
pattern.setPosition(Integer.valueOf(0));
|
||||||
List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern);
|
List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern);
|
||||||
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
||||||
readersCache.remove(acl.getId());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -420,7 +409,6 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
|
|||||||
pattern.setPosition(Integer.valueOf(0));
|
pattern.setPosition(Integer.valueOf(0));
|
||||||
List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern);
|
List<AclChange> changes = aclDaoComponent.deleteAccessControlEntries(report.getCreated().getId(), pattern);
|
||||||
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
getACLDAO(nodeRef).updateChangedAcls(nodeRef, changes);
|
||||||
readersCache.remove(acl.getId());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,12 +427,6 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions
|
|||||||
}
|
}
|
||||||
if (report.getCreated() != null)
|
if (report.getCreated() != null)
|
||||||
{
|
{
|
||||||
Acl acl = getAccessControlList(nodeRef);
|
|
||||||
if(acl != null)
|
|
||||||
{
|
|
||||||
readersCache.remove(acl.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleAccessControlEntry entry = new SimpleAccessControlEntry();
|
SimpleAccessControlEntry entry = new SimpleAccessControlEntry();
|
||||||
entry.setAuthority(authority);
|
entry.setAuthority(authority);
|
||||||
entry.setPermission(permission);
|
entry.setPermission(permission);
|
||||||
|
@@ -422,6 +422,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
if (!acl.isLatest())
|
if (!acl.isLatest())
|
||||||
{
|
{
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
|
readersCache.remove(id);
|
||||||
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
|
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,6 +471,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
aclCrudDAO.updateAcl(acl);
|
aclCrudDAO.updateAcl(acl);
|
||||||
}
|
}
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
|
readersCache.remove(id);
|
||||||
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
|
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
|
||||||
}
|
}
|
||||||
else if ((acl.getAclChangeSetId() == getCurrentChangeSetId()) && (!requiresVersion) && (!acl.getRequiresVersion()))
|
else if ((acl.getAclChangeSetId() == getCurrentChangeSetId()) && (!requiresVersion) && (!acl.getRequiresVersion()))
|
||||||
@@ -508,6 +510,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
aclCrudDAO.updateAcl(acl);
|
aclCrudDAO.updateAcl(acl);
|
||||||
}
|
}
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
|
readersCache.remove(id);
|
||||||
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
|
return new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -596,6 +599,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
acl.setRequiresVersion(Boolean.FALSE);
|
acl.setRequiresVersion(Boolean.FALSE);
|
||||||
aclCrudDAO.updateAcl(acl);
|
aclCrudDAO.updateAcl(acl);
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
|
readersCache.remove(id);
|
||||||
return new AclChangeImpl(id, created, acl.getAclType(), newAcl.getAclType());
|
return new AclChangeImpl(id, created, acl.getAclType(), newAcl.getAclType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -802,6 +806,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
aclCrudDAO.deleteAcl(aclId);
|
aclCrudDAO.deleteAcl(aclId);
|
||||||
|
|
||||||
aclCache.remove(aclId);
|
aclCache.remove(aclId);
|
||||||
|
readersCache.remove(aclId);
|
||||||
}
|
}
|
||||||
if (dbAcl.getAclType() == ACLType.SHARED)
|
if (dbAcl.getAclType() == ACLType.SHARED)
|
||||||
{
|
{
|
||||||
@@ -819,6 +824,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
aclCrudDAO.deleteAcl(aclId);
|
aclCrudDAO.deleteAcl(aclId);
|
||||||
|
|
||||||
aclCache.remove(aclId);
|
aclCache.remove(aclId);
|
||||||
|
readersCache.remove(aclId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -930,6 +936,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
|
|
||||||
// remove the deleted acl from the cache
|
// remove the deleted acl from the cache
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
|
readersCache.remove(id);
|
||||||
acls.add(new AclChangeImpl(id, null, acl.getAclType(), null));
|
acls.add(new AclChangeImpl(id, null, acl.getAclType(), null));
|
||||||
return acls;
|
return acls;
|
||||||
}
|
}
|
||||||
@@ -1260,6 +1267,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
acl.setInherits(Boolean.TRUE);
|
acl.setInherits(Boolean.TRUE);
|
||||||
aclCrudDAO.updateAcl(acl);
|
aclCrudDAO.updateAcl(acl);
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
|
readersCache.remove(id);
|
||||||
changes.add(new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType()));
|
changes.add(new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType()));
|
||||||
return changes;
|
return changes;
|
||||||
case SHARED:
|
case SHARED:
|
||||||
@@ -1305,6 +1313,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
acl.setInherits(Boolean.FALSE);
|
acl.setInherits(Boolean.FALSE);
|
||||||
aclCrudDAO.updateAcl(acl);
|
aclCrudDAO.updateAcl(acl);
|
||||||
aclCache.remove(id);
|
aclCache.remove(id);
|
||||||
|
readersCache.remove(id);
|
||||||
changes.add(new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType()));
|
changes.add(new AclChangeImpl(id, id, acl.getAclType(), acl.getAclType()));
|
||||||
return changes;
|
return changes;
|
||||||
case SHARED:
|
case SHARED:
|
||||||
@@ -1338,6 +1347,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
aclToCopy.setRequiresVersion(true);
|
aclToCopy.setRequiresVersion(true);
|
||||||
aclCrudDAO.updateAcl(aclToCopy);
|
aclCrudDAO.updateAcl(aclToCopy);
|
||||||
aclCache.remove(toCopy);
|
aclCache.remove(toCopy);
|
||||||
|
readersCache.remove(toCopy);
|
||||||
inheritedId = getInheritedAccessControlList(toCopy);
|
inheritedId = getInheritedAccessControlList(toCopy);
|
||||||
if ((inheritedId != null) && (!inheritedId.equals(toCopy)))
|
if ((inheritedId != null) && (!inheritedId.equals(toCopy)))
|
||||||
{
|
{
|
||||||
@@ -1345,6 +1355,7 @@ public class AclDAOImpl implements AclDAO
|
|||||||
inheritedAcl.setRequiresVersion(true);
|
inheritedAcl.setRequiresVersion(true);
|
||||||
aclCrudDAO.updateAcl(inheritedAcl);
|
aclCrudDAO.updateAcl(inheritedAcl);
|
||||||
aclCache.remove(inheritedId);
|
aclCache.remove(inheritedId);
|
||||||
|
readersCache.remove(inheritedId);
|
||||||
}
|
}
|
||||||
return toCopy;
|
return toCopy;
|
||||||
case REDIRECT:
|
case REDIRECT:
|
||||||
|
@@ -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.dynamic.LockOwnerDynamicAuthorityTest;
|
||||||
import org.alfresco.repo.security.permissions.impl.AclDaoComponentTest;
|
import org.alfresco.repo.security.permissions.impl.AclDaoComponentTest;
|
||||||
import org.alfresco.repo.security.permissions.impl.PermissionServiceTest;
|
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.ACLEntryAfterInvocationTest;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterTest;
|
import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterTest;
|
||||||
import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSetTest;
|
import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSetTest;
|
||||||
@@ -73,6 +74,7 @@ public class SecurityTestSuite extends TestSuite
|
|||||||
// Note org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizerTest has its own context and runs on its own
|
// Note org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizerTest has its own context and runs on its own
|
||||||
// suite.addTestSuite(ChainingUserRegistrySynchronizerTest.class);
|
// suite.addTestSuite(ChainingUserRegistrySynchronizerTest.class);
|
||||||
suite.addTestSuite(OwnableServiceTest.class);
|
suite.addTestSuite(OwnableServiceTest.class);
|
||||||
|
suite.addTestSuite(ReadPermissionTest.class);
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user