Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)

123902 jvonka: RA-750: Shared links API - get limited share link info (no auth required)
   - additional changes, as per updated A/Cs


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126545 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 11:25:32 +00:00
parent f79e7be94d
commit f752a61061
2 changed files with 22 additions and 20 deletions

View File

@@ -208,7 +208,9 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
String shared2Id = resp.getId();
// auth access to get shared link info - as user1
// currently passing auth should make no difference (irrespective of MT vs non-MY enb)
// access to get shared link info - pass user1 (but ignore in non-MT)
Map<String, String> params = Collections.singletonMap("include", "allowableOperations");
response = getSingle(QuickShareLinkEntityResource.class, user1, shared1Id, params, 200);
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
@@ -216,13 +218,14 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
assertEquals(shared1Id, resp.getId());
assertEquals(fileName1, resp.getName());
assertEquals(d1Id, resp.getNodeId());
assertNull(resp.getAllowableOperations()); // include is ignored
assertEquals(user1, resp.getModifiedByUser().getId()); // returned if authenticated
assertEquals(user2, resp.getSharedByUser().getId()); // returned if authenticated
assertNull(resp.getModifiedByUser().getId()); // userId not returned
assertEquals(user1+" "+user1, resp.getModifiedByUser().getDisplayName());
assertNull(resp.getSharedByUser().getId()); // userId not returned
assertEquals(user2+" "+user2, resp.getSharedByUser().getDisplayName());
assertNull(resp.getAllowableOperations());
// auth access to get shared link info - as user2
// access to get shared link info - pass user2 (but ignore in non-MT)
params = Collections.singletonMap("include", "allowableOperations");
response = getSingle(QuickShareLinkEntityResource.class, user2, shared1Id, params, 200);
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
@@ -230,14 +233,15 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
assertEquals(shared1Id, resp.getId());
assertEquals(fileName1, resp.getName());
assertEquals(d1Id, resp.getNodeId());
assertNull(resp.getAllowableOperations()); // include is ignored
assertEquals(user1, resp.getModifiedByUser().getId()); // returned if authenticated
assertEquals(user2, resp.getSharedByUser().getId()); // returned if authenticated
assertNull(resp.getModifiedByUser().getId()); // userId not returned
assertEquals(user1+" "+user1, resp.getModifiedByUser().getDisplayName());
assertNull(resp.getSharedByUser().getId()); // userId not returned
assertEquals(user2+" "+user2, resp.getSharedByUser().getDisplayName());
assertEquals(1, resp.getAllowableOperations().size());
assertEquals("delete", resp.getAllowableOperations().get(0));
// allowable operations not included
// allowable operations not included - no params
response = getSingle(QuickShareLinkEntityResource.class, user2, shared1Id, null, 200);
resp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), QuickShareLink.class);
assertNull(resp.getAllowableOperations());
@@ -250,7 +254,7 @@ public class SharedLinkApiTest extends AbstractBaseApiTest
assertEquals(shared1Id, resp.getId());
assertEquals(fileName1, resp.getName());
assertNull(resp.getNodeId()); // nodeId not returned
assertEquals(d1Id, resp.getNodeId());
assertNull(resp.getAllowableOperations()); // include is ignored
assertNull(resp.getModifiedByUser().getId()); // userId not returned