mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
124739 gjames: ACE-5295: listArchivedNodes now works for non-admin users git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126580 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -724,7 +724,7 @@ public class NodeArchiveServiceImpl implements NodeArchiveService
|
||||
|
||||
private Pair<NodeRef, QName> getArchiveNodeRefAssocTypePair(final NodeRef archiveStoreRootNodeRef)
|
||||
{
|
||||
String currentUser = getCurrentUser();
|
||||
final String currentUser = getCurrentUser();
|
||||
|
||||
if (archiveStoreRootNodeRef == null || !nodeService.exists(archiveStoreRootNodeRef))
|
||||
{
|
||||
@@ -738,12 +738,19 @@ public class NodeArchiveServiceImpl implements NodeArchiveService
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ChildAssociationRef> list = nodeService.getChildrenByName(archiveStoreRootNodeRef,
|
||||
ContentModel.ASSOC_ARCHIVE_USER_LINK,
|
||||
Collections.singletonList(currentUser));
|
||||
List<ChildAssociationRef> list = AuthenticationUtil.runAs(new RunAsWork<List<ChildAssociationRef>>()
|
||||
{
|
||||
@Override
|
||||
public List<ChildAssociationRef> doWork() throws Exception
|
||||
{
|
||||
return nodeService.getChildrenByName(archiveStoreRootNodeRef,
|
||||
ContentModel.ASSOC_ARCHIVE_USER_LINK,
|
||||
Collections.singletonList(currentUser));
|
||||
}
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
|
||||
// Empty list means that the current user hasn't deleted anything yet.
|
||||
if (list.isEmpty())
|
||||
if (list == null || list.isEmpty())
|
||||
{
|
||||
return new Pair<NodeRef, QName>(null, null);
|
||||
}
|
||||
|
@@ -1013,7 +1013,10 @@ public class ArchiveAndRestoreTest extends TestCase
|
||||
|
||||
// USER_B deletes "bb"
|
||||
nodeService.deleteNode(bb);
|
||||
|
||||
|
||||
result = nodeArchiveService.listArchivedNodes(queryBuilder);
|
||||
assertEquals("USER_B deleted 1 item and USER_B can see it.", 1, result.getPage().size());
|
||||
|
||||
result = runListArchivedNodesAsAdmin(queryBuilder);
|
||||
assertEquals("USER_B deleted only 1 item.", 1, result.getPage().size());
|
||||
|
||||
@@ -1026,6 +1029,9 @@ public class ArchiveAndRestoreTest extends TestCase
|
||||
this.archiveStoreRootNodeRef, paging)
|
||||
.build();
|
||||
|
||||
result = nodeArchiveService.listArchivedNodes(queryBuilder);
|
||||
assertEquals("USER_A deleted 1 item and USER_A can see it.", 1, result.getPage().size());
|
||||
|
||||
result = runListArchivedNodesAsAdmin(queryBuilder);
|
||||
assertEquals("USER_A deleted only 1 item.", 1, result.getPage().size());
|
||||
assertEquals(QNAME_AA.getLocalName(),
|
||||
|
Reference in New Issue
Block a user