RM-1675 (Moved in-place record is not shown non-RM Administrator users)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@89782 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-11-03 15:27:32 +00:00
parent c59cafb41f
commit c945c07530
2 changed files with 28 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
package org.alfresco.module.org_alfresco_module_rm.record; package org.alfresco.module.org_alfresco_module_rm.record;
import java.util.List; import java.util.List;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
@@ -159,11 +160,18 @@ public class InplaceRecordServiceImpl extends ServiceBaseImpl implements Inplace
{ {
try try
{ {
// Get the extended readers/writers
Set<String> extendedReaders = extendedSecurityService.getExtendedReaders(nodeRef);
Set<String> extendedWriters = extendedSecurityService.getExtendedWriters(nodeRef);
// Move the record // Move the record
fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null); fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null);
// Update the originating location property // Update the originating location property
nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef); nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef);
// Set the extended readers/writers
extendedSecurityService.addExtendedSecurity(nodeRef, extendedReaders, extendedWriters);
} }
catch (FileExistsException | FileNotFoundException ex) catch (FileExistsException | FileNotFoundException ex)
{ {

View File

@@ -18,7 +18,10 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.test.integration.record; package org.alfresco.module.org_alfresco_module_rm.test.integration.record;
import static org.apache.commons.collections.ListUtils.removeAll;
import java.util.List; import java.util.List;
import java.util.Set;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
@@ -54,6 +57,10 @@ public class MoveInplaceRecordTest extends BaseRMTestCase
// The destination folder in collaboration site // The destination folder in collaboration site
private NodeRef destinationDmFolder; private NodeRef destinationDmFolder;
// Extended Readers/Writers
private Set<String> extendedReadersBeforeMove;
private Set<String> extendedWritersBeforeMove;
public void given() public void given()
{ {
// Create the destination folder // Create the destination folder
@@ -76,6 +83,9 @@ public class MoveInplaceRecordTest extends BaseRMTestCase
// Check that the document is a record now // Check that the document is a record now
assertTrue(recordService.isRecord(dmDocument)); assertTrue(recordService.isRecord(dmDocument));
extendedReadersBeforeMove = extendedSecurityService.getExtendedReaders(dmDocument);
extendedWritersBeforeMove = extendedSecurityService.getExtendedWriters(dmDocument);
} }
public void when() public void when()
@@ -100,6 +110,16 @@ public class MoveInplaceRecordTest extends BaseRMTestCase
List<ChildAssociationRef> destinationFolderChildAssocs = nodeService.getChildAssocs(destinationDmFolder); List<ChildAssociationRef> destinationFolderChildAssocs = nodeService.getChildAssocs(destinationDmFolder);
assertEquals(1, destinationFolderChildAssocs.size()); assertEquals(1, destinationFolderChildAssocs.size());
assertEquals(dmDocument, destinationFolderChildAssocs.get(0).getChildRef()); assertEquals(dmDocument, destinationFolderChildAssocs.get(0).getChildRef());
// Check extended readers/writers
Set<String> extendedReadersAfterMove = extendedSecurityService.getExtendedReaders(dmDocument);
Set<String> extendedWritersAfterMove = extendedSecurityService.getExtendedWriters(dmDocument);
assertEquals(extendedReadersBeforeMove.size(), extendedReadersAfterMove.size());
assertEquals(extendedWritersBeforeMove.size(), extendedWritersAfterMove.size());
assertEquals(0, removeAll(extendedReadersBeforeMove, extendedReadersAfterMove).size());
assertEquals(0, removeAll(extendedWritersBeforeMove, extendedWritersAfterMove).size());
} }
}); });
} }