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:
Jamal Kaabi-Mofrad
2016-05-10 11:38:09 +00:00
parent 57310498c9
commit ce22405fd1
2 changed files with 19 additions and 6 deletions

View File

@@ -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);
}