mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1)
128135 jvonka: v1 REST API: fix possible NPE when optionally listing allowable ops for non-file/non-file (+ add sanity api test) REPO-488, REPO-514 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129127 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -903,9 +903,9 @@ public class NodesImpl implements Nodes
|
||||
String perm = kv.getKey();
|
||||
String op = kv.getValue();
|
||||
|
||||
if (perm.equals(PermissionService.ADD_CHILDREN) && type.equals(Type.DOCUMENT))
|
||||
if (perm.equals(PermissionService.ADD_CHILDREN) && Type.DOCUMENT.equals(type))
|
||||
{
|
||||
// special case: do not return "create" (as an allowable op) for file/content types
|
||||
// special case: do not return "create" (as an allowable op) for file/content types - note: 'type' can be null
|
||||
continue;
|
||||
}
|
||||
else if (perm.equals(PermissionService.DELETE) && (isSpecialNodeDoNotDelete(nodeRef, nodeTypeQName)))
|
||||
|
@@ -3600,8 +3600,23 @@ public class NodeApiTest extends AbstractBaseApiTest
|
||||
// -ve
|
||||
delete(URL_NODES, userId, siteNodeId, 403);
|
||||
|
||||
// cleanup
|
||||
delete(URL_NODES, user1, folderId, 204);
|
||||
// fix for REPO-514 (NPE for a node that was neither a file/document nor a folder)
|
||||
Node n = new Node();
|
||||
n.setName("o1");
|
||||
n.setNodeType(TYPE_CM_OBJECT);
|
||||
response = post(getNodeChildrenUrl(folderId), user1, toJsonAsStringNonNull(n), 201);
|
||||
nodeResp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class);
|
||||
String o1Id = nodeResp.getId();
|
||||
|
||||
params = new HashMap<>();
|
||||
params.put("include", "allowableOperations");
|
||||
response = getSingle(NodesEntityResource.class, user1, o1Id, params, 200);
|
||||
nodeResp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class);
|
||||
assertNotNull(nodeResp.getAllowableOperations());
|
||||
|
||||
// some cleanup
|
||||
params = Collections.singletonMap("permanent", "true");
|
||||
delete(URL_NODES, user1, folderId, params, 204);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user