REPO-1709: V1 REST API - fix download content (fails unexpectedly with 403)

- introduced by REPO-265

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@133619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2016-12-13 14:47:15 +00:00
parent 1622adeab0
commit f65ce88f03
2 changed files with 77 additions and 4 deletions

View File

@@ -1978,7 +1978,7 @@ public class NodesImpl implements Nodes
}
/**
* Posts activites based on the activity_type.
* Posts activities based on the activity_type.
* If the method is called with aSync=true then a TransactionListener is used post the activity
* afterCommit. Otherwise the activity posting is done synchronously.
* @param activity_type
@@ -2009,9 +2009,19 @@ public class NodesImpl implements Nodes
}
}
// note: see also org.alfresco.opencmis.ActivityPosterImpl
protected ActivityInfo getActivityInfo(NodeRef parentNodeRef, NodeRef nodeRef)
{
SiteInfo siteInfo = siteService.getSite(nodeRef);
// runAs system, eg. user may not have permission see one or more parents (irrespective of whether in a site context of not)
SiteInfo siteInfo = AuthenticationUtil.runAs(new RunAsWork<SiteInfo>()
{
@Override
public SiteInfo doWork() throws Exception
{
return siteService.getSite(nodeRef);
}
}, AuthenticationUtil.getSystemUserName());
String siteId = (siteInfo != null ? siteInfo.getShortName() : null);
if(siteId != null && !siteId.equals(""))
{