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:
Ancuta Morarasu
2016-05-11 12:12:03 +00:00
parent 03b2b9ea85
commit 22d42b4761
2 changed files with 19 additions and 6 deletions

View File

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