mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126427 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 121844 jvonka: Quick Share Link API - initial commit (work-in-progress) - demonstrate WebApiNoAuth - auth required to create &/or delete quick share link - no auth required to get &/or download content for a quick share link - TODO review detailed api & impl (+ add tests) RA-775, RA-773, RA-750, RA-708, RA-776 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126773 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,7 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.tenant.TenantUtil;
|
||||
import org.alfresco.repo.web.scripts.content.ContentStreamer;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.core.HttpMethodSupport;
|
||||
@@ -37,6 +38,7 @@ import org.alfresco.rest.framework.core.ResourceWithMetadata;
|
||||
import org.alfresco.rest.framework.core.exceptions.ApiException;
|
||||
import org.alfresco.rest.framework.jacksonextensions.JacksonHelper;
|
||||
import org.alfresco.rest.framework.resource.actions.ActionExecutor;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.BinaryResourceAction;
|
||||
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||
import org.alfresco.rest.framework.resource.content.ContentInfo;
|
||||
import org.alfresco.rest.framework.resource.content.FileBinaryResource;
|
||||
@@ -49,6 +51,7 @@ import org.codehaus.jackson.JsonGenerator;
|
||||
import org.codehaus.jackson.map.JsonMappingException;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.springframework.extensions.surf.util.URLEncoder;
|
||||
import org.springframework.extensions.webscripts.Description;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
@@ -124,7 +127,7 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
||||
});
|
||||
|
||||
//Outside the transaction.
|
||||
Object toSerialize = respons.get("toSerialize");
|
||||
final Object toSerialize = respons.get("toSerialize");
|
||||
ContentInfo contentInfo = (ContentInfo) respons.get("contentInfo");
|
||||
|
||||
// set caching (MNT-13938)
|
||||
@@ -137,7 +140,25 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
||||
{
|
||||
if (toSerialize instanceof BinaryResource)
|
||||
{
|
||||
streamResponse(req, res, (BinaryResource) toSerialize);
|
||||
// TODO review (experimental) - can we move earlier & wrap complete execute ? Also for QuickShare (in MT/Cloud) needs to be tenant for the nodeRef (TBC).
|
||||
boolean noAuth = resource.getMetaData().isNoAuth(BinaryResourceAction.Read.class);
|
||||
if (noAuth)
|
||||
{
|
||||
String networkTenantDomain = TenantUtil.getCurrentDomain();
|
||||
|
||||
TenantUtil.runAsSystemTenant(new TenantUtil.TenantRunAsWork<Void>()
|
||||
{
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
streamResponse(req, res, (BinaryResource) toSerialize);
|
||||
return null;
|
||||
}
|
||||
}, networkTenantDomain);
|
||||
}
|
||||
else
|
||||
{
|
||||
streamResponse(req, res, (BinaryResource) toSerialize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -250,5 +271,4 @@ public abstract class AbstractResourceWebScript extends ApiWebScript implements
|
||||
{
|
||||
this.streamer = streamer;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user