mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126580 jkaabimofrad: 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/BRANCHES/DEV/5.2.N/root@126925 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -731,7 +731,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))
|
||||
{
|
||||
@@ -745,12 +745,19 @@ public class NodeArchiveServiceImpl implements NodeArchiveService
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ChildAssociationRef> list = nodeService.getChildrenByName(archiveStoreRootNodeRef,
|
||||
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);
|
||||
}
|
||||
|
@@ -1023,6 +1023,9 @@ 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());
|
||||
|
||||
@@ -1035,6 +1038,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