mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix WCM/AVM test failures (fallout from CMIS 1.0 merge: r17764 -> r18790)
- AssetServiceImplTest - SandboxServiceImplTest - AssetTest git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18840 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@@ -35,6 +35,7 @@ import org.alfresco.repo.domain.DbAccessControlList;
|
|||||||
import org.alfresco.repo.domain.PropertyValue;
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.repo.security.permissions.ACLCopyMode;
|
import org.alfresco.repo.security.permissions.ACLCopyMode;
|
||||||
import org.alfresco.repo.security.permissions.ACLType;
|
import org.alfresco.repo.security.permissions.ACLType;
|
||||||
|
import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl;
|
||||||
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||||
@@ -1047,31 +1048,12 @@ public class AVMSyncServiceImpl implements AVMSyncService
|
|||||||
}
|
}
|
||||||
else if (dstAcl.getAclType().equals(ACLType.DEFINING))
|
else if (dstAcl.getAclType().equals(ACLType.DEFINING))
|
||||||
{
|
{
|
||||||
// compare ACEs
|
boolean same = compareACEs(srcDesc, dstDesc);
|
||||||
NodeRef srcNodeRef = AVMNodeConverter.ToNodeRef(-1, srcDesc.getPath());
|
|
||||||
Set<AccessPermission> srcSet = fPermissionService.getAllSetPermissions(srcNodeRef);
|
|
||||||
|
|
||||||
NodeRef dstNodeRef = AVMNodeConverter.ToNodeRef(-1, dstDesc.getPath());
|
|
||||||
Set<AccessPermission> dstSet = fPermissionService.getAllSetPermissions(dstNodeRef);
|
|
||||||
|
|
||||||
if (srcSet.size() == dstSet.size())
|
|
||||||
{
|
|
||||||
boolean same = true;
|
|
||||||
for (AccessPermission srcPerm : srcSet)
|
|
||||||
{
|
|
||||||
if (! dstSet.contains(srcPerm))
|
|
||||||
{
|
|
||||||
same = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (same)
|
if (same)
|
||||||
{
|
{
|
||||||
return AVMDifference.SAME;
|
return AVMDifference.SAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO review
|
// TODO review
|
||||||
@@ -1082,33 +1064,12 @@ public class AVMSyncServiceImpl implements AVMSyncService
|
|||||||
{
|
{
|
||||||
if ((dstAcl == null) || dstAcl.getAclType().equals(ACLType.SHARED))
|
if ((dstAcl == null) || dstAcl.getAclType().equals(ACLType.SHARED))
|
||||||
{
|
{
|
||||||
// compare ACEs
|
boolean same = compareACEs(srcDesc, dstDesc);
|
||||||
NodeRef srcNodeRef = AVMNodeConverter.ToNodeRef(-1, srcDesc.getPath());
|
|
||||||
Set<AccessPermission> srcSet = fPermissionService.getAllSetPermissions(srcNodeRef);
|
|
||||||
|
|
||||||
NodeRef dstNodeRef = AVMNodeConverter.ToNodeRef(-1, dstDesc.getPath());
|
|
||||||
Set<AccessPermission> dstSet = fPermissionService.getAllSetPermissions(dstNodeRef);
|
|
||||||
|
|
||||||
if (srcSet.size() == dstSet.size())
|
|
||||||
{
|
|
||||||
boolean same = true;
|
|
||||||
for (AccessPermission srcPerm : srcSet)
|
|
||||||
{
|
|
||||||
if (! dstSet.contains(srcPerm))
|
|
||||||
{
|
|
||||||
same = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (same)
|
if (same)
|
||||||
{
|
{
|
||||||
return AVMDifference.SAME;
|
return AVMDifference.SAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AVMDifference.CONFLICT;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO review
|
// TODO review
|
||||||
@@ -1127,6 +1088,85 @@ public class AVMSyncServiceImpl implements AVMSyncService
|
|||||||
return AVMDifference.CONFLICT;
|
return AVMDifference.CONFLICT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean compareACEs(AVMNodeDescriptor srcDesc, AVMNodeDescriptor dstDesc)
|
||||||
|
{
|
||||||
|
boolean same = false;
|
||||||
|
|
||||||
|
NodeRef srcNodeRef = AVMNodeConverter.ToNodeRef(-1, srcDesc.getPath());
|
||||||
|
Set<AccessPermission> srcSet = fPermissionService.getAllSetPermissions(srcNodeRef);
|
||||||
|
|
||||||
|
NodeRef dstNodeRef = AVMNodeConverter.ToNodeRef(-1, dstDesc.getPath());
|
||||||
|
Set<AccessPermission> dstSet = fPermissionService.getAllSetPermissions(dstNodeRef);
|
||||||
|
|
||||||
|
if (srcSet.size() == dstSet.size())
|
||||||
|
{
|
||||||
|
for (AccessPermission srcPerm : srcSet)
|
||||||
|
{
|
||||||
|
for (AccessPermission dstPerm : dstSet)
|
||||||
|
{
|
||||||
|
if (compareAccessPermission(srcPerm, dstPerm))
|
||||||
|
{
|
||||||
|
same = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return same;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean compareAccessPermission(AccessPermission srcPerm, AccessPermission dstPerm)
|
||||||
|
{
|
||||||
|
// TODO: currently ignores position (refer to updated AccessPermissionImpl.equals)
|
||||||
|
if (srcPerm == dstPerm)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (srcPerm == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcPerm.getAccessStatus() == null)
|
||||||
|
{
|
||||||
|
if (dstPerm.getAccessStatus() != null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (! srcPerm.getAccessStatus().equals(dstPerm.getAccessStatus()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcPerm.getAuthority() == null)
|
||||||
|
{
|
||||||
|
if (dstPerm.getAuthority() != null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (! srcPerm.getAuthority().equals(dstPerm.getAuthority()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcPerm.getPermission() == null)
|
||||||
|
{
|
||||||
|
if (dstPerm.getPermission() != null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (! srcPerm.getPermission().equals(dstPerm.getPermission()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flattens a layer so that all all nodes under and including
|
* Flattens a layer so that all all nodes under and including
|
||||||
* <code>layerPath</code> become translucent to any nodes in the
|
* <code>layerPath</code> become translucent to any nodes in the
|
||||||
|
Reference in New Issue
Block a user