mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
127312 jkaabimofrad: SFS-577, SFS-581: Fixed the shared-link no-auth APIs issue with multi-tenancy. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127316 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1950,15 +1950,20 @@ public class NodesImpl implements Nodes
|
||||
public BinaryResource getContent(String fileNodeId, Parameters parameters, boolean recordActivity)
|
||||
{
|
||||
final NodeRef nodeRef = validateNode(fileNodeId);
|
||||
return getContent(nodeRef, parameters, recordActivity);
|
||||
}
|
||||
|
||||
if (! nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null, false))
|
||||
@Override
|
||||
public BinaryResource getContent(NodeRef nodeRef, Parameters parameters, boolean recordActivity)
|
||||
{
|
||||
if (!nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null, false))
|
||||
{
|
||||
throw new InvalidArgumentException("NodeId of content is expected: "+nodeRef.getId());
|
||||
throw new InvalidArgumentException("NodeId of content is expected: " + nodeRef.getId());
|
||||
}
|
||||
|
||||
Map<QName, Serializable> nodeProps = nodeService.getProperties(nodeRef);
|
||||
ContentData cd = (ContentData)nodeProps.get(ContentModel.PROP_CONTENT);
|
||||
String name = (String)nodeProps.get(ContentModel.PROP_NAME);
|
||||
ContentData cd = (ContentData) nodeProps.get(ContentModel.PROP_CONTENT);
|
||||
String name = (String) nodeProps.get(ContentModel.PROP_NAME);
|
||||
|
||||
org.alfresco.rest.framework.resource.content.ContentInfo ci = null;
|
||||
String mimeType = null;
|
||||
@@ -1982,7 +1987,7 @@ public class NodesImpl implements Nodes
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("Ignored attachment=false for "+fileNodeId+" since "+mimeType+" is not in the whitelist for non-attach content types");
|
||||
logger.warn("Ignored attachment=false for "+nodeRef.getId()+" since "+mimeType+" is not in the whitelist for non-attach content types");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1990,7 +1995,7 @@ public class NodesImpl implements Nodes
|
||||
|
||||
if (recordActivity)
|
||||
{
|
||||
final ActivityInfo activityInfo = getActivityInfo(getParentNodeRef(nodeRef), nodeRef);
|
||||
final ActivityInfo activityInfo = getActivityInfo(getParentNodeRef(nodeRef), nodeRef);
|
||||
postActivity(Activity_Type.DOWNLOADED, activityInfo, true);
|
||||
}
|
||||
|
||||
|
@@ -230,15 +230,13 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
||||
throw new InvalidNodeRefException(nodeRef);
|
||||
}
|
||||
|
||||
String nodeId = nodeRef.getId();
|
||||
|
||||
if (renditionId != null)
|
||||
{
|
||||
return renditions.getContent(nodeId, renditionId, parameters);
|
||||
return renditions.getContent(nodeRef, renditionId, parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nodes.getContent(nodeId, parameters, false);
|
||||
return nodes.getContent(nodeRef, parameters, false);
|
||||
}
|
||||
}
|
||||
}, networkTenantDomain);
|
||||
|
@@ -21,6 +21,7 @@ package org.alfresco.rest.api.impl;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.query.PagingResults;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.thumbnail.ThumbnailDefinition;
|
||||
import org.alfresco.repo.thumbnail.ThumbnailHelper;
|
||||
import org.alfresco.repo.thumbnail.ThumbnailRegistry;
|
||||
@@ -96,6 +97,7 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
||||
private NamespaceService namespaceService;
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private ResourceLoader resourceLoader;
|
||||
private TenantService tenantService;
|
||||
|
||||
public void setNodes(Nodes nodes)
|
||||
{
|
||||
@@ -123,12 +125,18 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
public void setTenantService(TenantService tenantService)
|
||||
{
|
||||
this.tenantService = tenantService;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
PropertyCheck.mandatory(this, "nodes", nodes);
|
||||
PropertyCheck.mandatory(this, "thumbnailService", thumbnailService);
|
||||
PropertyCheck.mandatory(this, "scriptThumbnailService", scriptThumbnailService);
|
||||
PropertyCheck.mandatory(this, "serviceRegistry", serviceRegistry);
|
||||
PropertyCheck.mandatory(this, "tenantService", tenantService);
|
||||
|
||||
this.nodeService = serviceRegistry.getNodeService();
|
||||
this.actionService = serviceRegistry.getActionService();
|
||||
@@ -288,7 +296,13 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
||||
public BinaryResource getContent(String nodeId, String renditionId, Parameters parameters)
|
||||
{
|
||||
final NodeRef sourceNodeRef = validateSourceNode(nodeId);
|
||||
final NodeRef renditionNodeRef = getRenditionByName(sourceNodeRef, renditionId, parameters);
|
||||
return getContent(sourceNodeRef, renditionId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryResource getContent(NodeRef sourceNodeRef, String renditionId, Parameters parameters)
|
||||
{
|
||||
NodeRef renditionNodeRef = getRenditionByName(sourceNodeRef, renditionId, parameters);
|
||||
|
||||
// By default set attachment header (with rendition Id) unless attachment=false
|
||||
boolean attach = true;
|
||||
@@ -382,7 +396,8 @@ public class RenditionsImpl implements Renditions, ResourceLoaderAware
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return nodeRefRendition.getChildRef();
|
||||
|
||||
return tenantService.getName(nodeRef, nodeRefRendition.getChildRef());
|
||||
}
|
||||
|
||||
protected Rendition toApiRendition(NodeRef renditionNodeRef)
|
||||
|
Reference in New Issue
Block a user