mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged WEBAPP-API (5.2.1) to 5.2.N (5.2.1)
136574 jkaabimofrad: APPSREPO-179: Added an optional "include=path" parameter to the "list shared links" API. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@136708 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -37,11 +37,13 @@ import org.alfresco.rest.api.model.Document;
|
||||
import org.alfresco.rest.api.model.Folder;
|
||||
import org.alfresco.rest.api.model.LockInfo;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.api.model.PathInfo;
|
||||
import org.alfresco.rest.api.model.UserInfo;
|
||||
import org.alfresco.rest.framework.resource.content.BasicContentInfo;
|
||||
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -290,6 +292,15 @@ public interface Nodes
|
||||
*/
|
||||
Map<QName, Serializable> mapToNodeProperties(Map<String, Object> props);
|
||||
|
||||
/**
|
||||
* Returns the path to the given nodeRef {@code nodeRefIn} or the archived nodeRef {@code archivedParentAssoc}.
|
||||
*
|
||||
* @param nodeRefIn the NodeRef
|
||||
* @param archivedParentAssoc the ChildAssociationRef of the archived NodeRef
|
||||
* @return the path to the given node
|
||||
*/
|
||||
PathInfo lookupPathInfo(NodeRef nodeRefIn, ChildAssociationRef archivedParentAssoc);
|
||||
|
||||
/**
|
||||
* Map from a String representation of aspect names to a set
|
||||
* of QName objects, as used by the repository.
|
||||
|
@@ -131,4 +131,6 @@ public interface QuickShareLinks
|
||||
String PARAM_SHAREDBY = "sharedByUser";
|
||||
|
||||
String PARAM_INCLUDE_ALLOWABLEOPERATIONS = Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS;
|
||||
|
||||
String PARAM_INCLUDE_PATH = Nodes.PARAM_INCLUDE_PATH;
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -1028,7 +1028,8 @@ public class NodesImpl implements Nodes
|
||||
return node;
|
||||
}
|
||||
|
||||
protected PathInfo lookupPathInfo(NodeRef nodeRefIn, ChildAssociationRef archivedParentAssoc)
|
||||
@Override
|
||||
public PathInfo lookupPathInfo(NodeRef nodeRefIn, ChildAssociationRef archivedParentAssoc)
|
||||
{
|
||||
|
||||
List<ElementInfo> pathElements = new ArrayList<>();
|
||||
|
@@ -579,13 +579,20 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
|
||||
qs.setExpiresAt((Date) map.get("expiryDate"));
|
||||
|
||||
// note: if noAuth mode then do not return allowable operations (eg. but can be optionally returned when finding shared links)
|
||||
if ((! noAuth) && includeParam.contains(PARAM_INCLUDE_ALLOWABLEOPERATIONS))
|
||||
if (!noAuth)
|
||||
{
|
||||
if (quickShareService.canDeleteSharedLink(nodeRef, sharedByUserId))
|
||||
if (includeParam.contains(PARAM_INCLUDE_ALLOWABLEOPERATIONS) && quickShareService.canDeleteSharedLink(nodeRef, sharedByUserId))
|
||||
{
|
||||
qs.setAllowableOperations(Collections.singletonList(Nodes.OP_DELETE));
|
||||
}
|
||||
|
||||
// in noAuth mode we don't return the path info
|
||||
if (includeParam.contains(PARAM_INCLUDE_PATH))
|
||||
{
|
||||
qs.setPathInfo(nodes.lookupPathInfo(nodeRef, null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return qs;
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Remote API
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -51,14 +51,13 @@ public class QuickShareLink
|
||||
private Date expiresAt;
|
||||
|
||||
private String nodeId;
|
||||
|
||||
private String name;
|
||||
private PathInfo pathInfo;
|
||||
|
||||
private ContentInfo content;
|
||||
|
||||
private Date modifiedAt;
|
||||
private UserInfo modifiedByUser;
|
||||
|
||||
private UserInfo sharedByUser;
|
||||
|
||||
private List<String> allowableOperations;
|
||||
@@ -120,6 +119,16 @@ public class QuickShareLink
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public PathInfo getPathInfo()
|
||||
{
|
||||
return pathInfo;
|
||||
}
|
||||
|
||||
public void setPathInfo(PathInfo pathInfo)
|
||||
{
|
||||
this.pathInfo = pathInfo;
|
||||
}
|
||||
|
||||
public Date getModifiedAt()
|
||||
{
|
||||
return modifiedAt;
|
||||
@@ -168,6 +177,7 @@ public class QuickShareLink
|
||||
sb.append("QuickShareLink [id=").append(getId());
|
||||
sb.append(", nodeId=").append(getNodeId());
|
||||
sb.append(", name=").append(getName());
|
||||
sb.append(", pathInfo=").append(getPathInfo());
|
||||
sb.append(", modifiedAt=").append(getModifiedAt());
|
||||
sb.append(", modifiedByUser=").append(getModifiedByUser());
|
||||
sb.append(", sharedByUser=").append(getSharedByUser());
|
||||
|
Reference in New Issue
Block a user