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:
Jamal Kaabi-Mofrad
2017-05-12 09:30:10 +00:00
parent da8e77045b
commit b5e541d3de
5 changed files with 40 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Remote API * 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. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * 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.Folder;
import org.alfresco.rest.api.model.LockInfo; import org.alfresco.rest.api.model.LockInfo;
import org.alfresco.rest.api.model.Node; 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.api.model.UserInfo;
import org.alfresco.rest.framework.resource.content.BasicContentInfo; import org.alfresco.rest.framework.resource.content.BasicContentInfo;
import org.alfresco.rest.framework.resource.content.BinaryResource; import org.alfresco.rest.framework.resource.content.BinaryResource;
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
import org.alfresco.rest.framework.resource.parameters.Parameters; 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.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -290,6 +292,15 @@ public interface Nodes
*/ */
Map<QName, Serializable> mapToNodeProperties(Map<String, Object> props); 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 * Map from a String representation of aspect names to a set
* of QName objects, as used by the repository. * of QName objects, as used by the repository.

View File

@@ -131,4 +131,6 @@ public interface QuickShareLinks
String PARAM_SHAREDBY = "sharedByUser"; String PARAM_SHAREDBY = "sharedByUser";
String PARAM_INCLUDE_ALLOWABLEOPERATIONS = Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS; String PARAM_INCLUDE_ALLOWABLEOPERATIONS = Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS;
String PARAM_INCLUDE_PATH = Nodes.PARAM_INCLUDE_PATH;
} }

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Remote API * 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. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
@@ -1028,7 +1028,8 @@ public class NodesImpl implements Nodes
return node; return node;
} }
protected PathInfo lookupPathInfo(NodeRef nodeRefIn, ChildAssociationRef archivedParentAssoc) @Override
public PathInfo lookupPathInfo(NodeRef nodeRefIn, ChildAssociationRef archivedParentAssoc)
{ {
List<ElementInfo> pathElements = new ArrayList<>(); List<ElementInfo> pathElements = new ArrayList<>();

View File

@@ -579,13 +579,20 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
qs.setExpiresAt((Date) map.get("expiryDate")); 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) // 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)); 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; return qs;
} }

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Remote API * 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. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
@@ -51,14 +51,13 @@ public class QuickShareLink
private Date expiresAt; private Date expiresAt;
private String nodeId; private String nodeId;
private String name; private String name;
private PathInfo pathInfo;
private ContentInfo content; private ContentInfo content;
private Date modifiedAt; private Date modifiedAt;
private UserInfo modifiedByUser; private UserInfo modifiedByUser;
private UserInfo sharedByUser; private UserInfo sharedByUser;
private List<String> allowableOperations; private List<String> allowableOperations;
@@ -120,6 +119,16 @@ public class QuickShareLink
this.name = name; this.name = name;
} }
public PathInfo getPathInfo()
{
return pathInfo;
}
public void setPathInfo(PathInfo pathInfo)
{
this.pathInfo = pathInfo;
}
public Date getModifiedAt() public Date getModifiedAt()
{ {
return modifiedAt; return modifiedAt;
@@ -168,6 +177,7 @@ public class QuickShareLink
sb.append("QuickShareLink [id=").append(getId()); sb.append("QuickShareLink [id=").append(getId());
sb.append(", nodeId=").append(getNodeId()); sb.append(", nodeId=").append(getNodeId());
sb.append(", name=").append(getName()); sb.append(", name=").append(getName());
sb.append(", pathInfo=").append(getPathInfo());
sb.append(", modifiedAt=").append(getModifiedAt()); sb.append(", modifiedAt=").append(getModifiedAt());
sb.append(", modifiedByUser=").append(getModifiedByUser()); sb.append(", modifiedByUser=").append(getModifiedByUser());
sb.append(", sharedByUser=").append(getSharedByUser()); sb.append(", sharedByUser=").append(getSharedByUser());