From 53d4bef625c71766da2775e7b09f3fc162b45191 Mon Sep 17 00:00:00 2001 From: Andrew Hind Date: Fri, 23 Oct 2009 09:30:30 +0000 Subject: [PATCH] Fix for ETHREEOH-2962: Fix copy service to respect all permissions on copy (readContent, readPermissions) and fix up r 16641 for RM - copy no longer copies permissions git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17109 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/repo/copy/CopyServiceImpl.java | 45 +------------------ 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/source/java/org/alfresco/repo/copy/CopyServiceImpl.java b/source/java/org/alfresco/repo/copy/CopyServiceImpl.java index 2930236117..82991dfedd 100644 --- a/source/java/org/alfresco/repo/copy/CopyServiceImpl.java +++ b/source/java/org/alfresco/repo/copy/CopyServiceImpl.java @@ -554,8 +554,7 @@ public class CopyServiceImpl implements CopyService copyProperties.put(ContentModel.PROP_COPY_REFERENCE, sourceNodeRef); internalNodeService.addAspect(targetNodeRef, ContentModel.ASPECT_COPIEDFROM, copyProperties); - // Copy permissions - copyPermissions(sourceNodeRef, targetNodeRef); + // Do not copy permissions // We present the recursion option regardless of what the client chooses copyChildren( @@ -682,48 +681,6 @@ public class CopyServiceImpl implements CopyService } } - /** - * Copies the permissions of the source node reference onto the destination node reference - * - * @param sourceNodeRef the source node reference - * @param destinationNodeRef the destination node reference - */ - private void copyPermissions(final NodeRef sourceNodeRef, final NodeRef destinationNodeRef) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() throws Exception - { - - if(permissionService.hasPermission(sourceNodeRef, PermissionService.READ_PERMISSIONS) == AccessStatus.ALLOWED) - { - // Get the permission details of the source node reference - Set permissions = permissionService.getAllSetPermissions(sourceNodeRef); - boolean includeInherited = permissionService.getInheritParentPermissions(sourceNodeRef); - - AccessStatus writePermission = permissionService.hasPermission(destinationNodeRef, PermissionService.CHANGE_PERMISSIONS); - if (writePermission.equals(AccessStatus.ALLOWED) || authenticationService.isCurrentUserTheSystemUser() ) - { - // Set the permission values on the destination node - for (AccessPermission permission : permissions) - { - if(permission.isSetDirectly()) - { - permissionService.setPermission( - destinationNodeRef, - permission.getAuthority(), - permission.getPermission(), - permission.getAccessStatus().equals(AccessStatus.ALLOWED)); - } - } - permissionService.setInheritParentPermissions(destinationNodeRef, includeInherited); - } - } - - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } /** * Gets the copy details. This calls the appropriate policies that have been registered