mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
Better performance for DM permission migration.
Fix ups to follow only direct parent links git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9322 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
48d8cb6864
commit
162cf4e2e1
@ -165,7 +165,7 @@ public class DMAccessControlListDAO implements AccessControlListDAO
|
|||||||
{
|
{
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
CounterSet update;
|
CounterSet update;
|
||||||
update = fixOldDmAcls(nodeService.getRootNode(store));
|
update = fixOldDmAcls(nodeService.getRootNode(store), null, true);
|
||||||
result.add(update);
|
result.add(update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,12 +180,12 @@ public class DMAccessControlListDAO implements AccessControlListDAO
|
|||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CounterSet fixOldDmAcls(NodeRef nodeRef)
|
private CounterSet fixOldDmAcls(NodeRef nodeRef, Long inherited, boolean isRoot)
|
||||||
{
|
{
|
||||||
hibernateSessionHelper.mark();
|
hibernateSessionHelper.mark();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return fixOldDmAclsImpl(nodeRef);
|
return fixOldDmAclsImpl(nodeRef, inherited, isRoot);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -193,31 +193,23 @@ public class DMAccessControlListDAO implements AccessControlListDAO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CounterSet fixOldDmAclsImpl(NodeRef nodeRef)
|
private CounterSet fixOldDmAclsImpl(NodeRef nodeRef, Long inherited, boolean isRoot)
|
||||||
{
|
{
|
||||||
CounterSet result = new CounterSet();
|
CounterSet result = new CounterSet();
|
||||||
// Do the children first
|
// Do the children first
|
||||||
|
|
||||||
for (ChildAssociationRef child : nodeService.getChildAssocs(nodeRef))
|
|
||||||
{
|
|
||||||
if (child.isPrimary())
|
|
||||||
{
|
|
||||||
CounterSet update = fixOldDmAcls(child.getChildRef());
|
|
||||||
result.add(update);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DbAccessControlList existingAcl = getAccessControlList(nodeRef);
|
DbAccessControlList existingAcl = getAccessControlList(nodeRef);
|
||||||
|
Long toInherit = inherited;
|
||||||
|
|
||||||
if (existingAcl != null)
|
if (existingAcl != null)
|
||||||
{
|
{
|
||||||
if (existingAcl.getAclType() == ACLType.OLD)
|
if (existingAcl.getAclType() == ACLType.OLD)
|
||||||
{
|
{
|
||||||
result.increment(ACLType.DEFINING);
|
result.increment(ACLType.DEFINING);
|
||||||
//
|
|
||||||
SimpleAccessControlListProperties properties = DMPermissionsDaoComponentImpl.getDefaultProperties();
|
SimpleAccessControlListProperties properties = DMPermissionsDaoComponentImpl.getDefaultProperties();
|
||||||
// Accept default versioning
|
properties.setInherits(existingAcl.getInherits());
|
||||||
Long id = aclDaoComponent.createAccessControlList(properties);
|
Long id = aclDaoComponent.createAccessControlList(properties);
|
||||||
|
|
||||||
DbAccessControlList newAcl = aclDaoComponent.getDbAccessControlList(id);
|
DbAccessControlList newAcl = aclDaoComponent.getDbAccessControlList(id);
|
||||||
|
|
||||||
AccessControlList existing = aclDaoComponent.getAccessControlList(existingAcl.getId());
|
AccessControlList existing = aclDaoComponent.getAccessControlList(existingAcl.getId());
|
||||||
@ -228,18 +220,53 @@ public class DMAccessControlListDAO implements AccessControlListDAO
|
|||||||
aclDaoComponent.setAccessControlEntry(id, entry);
|
aclDaoComponent.setAccessControlEntry(id, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (existingAcl.getInherits())
|
||||||
|
{
|
||||||
|
if (toInherit != null)
|
||||||
|
{
|
||||||
|
aclDaoComponent.enableInheritance(id, toInherit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toInherit = aclDaoComponent.getInheritedAccessControlList(id);
|
||||||
|
|
||||||
setAccessControlList(nodeRef, newAcl);
|
setAccessControlList(nodeRef, newAcl);
|
||||||
|
|
||||||
// Cascade to children - changes should all be 1-1 so we do not have to post fix
|
|
||||||
|
|
||||||
List<AclChange> changes = new ArrayList<AclChange>();
|
|
||||||
|
|
||||||
setFixedAcls(nodeRef, aclDaoComponent.getInheritedAccessControlList(id), changes, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Already fixed up :-)
|
// Already fixed up
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set default ACL on roots with no settings
|
||||||
|
if (isRoot)
|
||||||
|
{
|
||||||
|
result.increment(ACLType.DEFINING);
|
||||||
|
SimpleAccessControlListProperties properties = DMPermissionsDaoComponentImpl.getDefaultProperties();
|
||||||
|
Long id = aclDaoComponent.createAccessControlList(properties);
|
||||||
|
|
||||||
|
DbAccessControlList newAcl = aclDaoComponent.getDbAccessControlList(id);
|
||||||
|
|
||||||
|
toInherit = aclDaoComponent.getInheritedAccessControlList(id);
|
||||||
|
|
||||||
|
setAccessControlList(nodeRef, newAcl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Unset - simple inherit
|
||||||
|
DbAccessControlList inheritedAcl = aclDaoComponent.getDbAccessControlList(toInherit);
|
||||||
|
setAccessControlList(nodeRef, inheritedAcl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ChildAssociationRef child : nodeService.getChildAssocs(nodeRef))
|
||||||
|
{
|
||||||
|
if (child.isPrimary())
|
||||||
|
{
|
||||||
|
CounterSet update = fixOldDmAcls(child.getChildRef(), toInherit, false);
|
||||||
|
result.add(update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,10 +346,13 @@ public class DMAccessControlListDAO implements AccessControlListDAO
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
else if (acl.getAclType() == ACLType.DEFINING)
|
else if (acl.getAclType() == ACLType.DEFINING)
|
||||||
|
{
|
||||||
|
if (acl.getInherits())
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
List<AclChange> newChanges = aclDaoComponent.mergeInheritedAccessControlList(mergeFrom, acl.getId());
|
List<AclChange> newChanges = aclDaoComponent.mergeInheritedAccessControlList(mergeFrom, acl.getId());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hibernateSessionHelper.mark();
|
hibernateSessionHelper.mark();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user