Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

128375 jvonka: MNT-16446: Edit Comment permission (part 3) 
   - for CMIS (and also future v1 Nodes REST API)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@128386 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2016-06-27 19:08:30 +00:00
parent a3d4f5c0d1
commit 0020afb335
4 changed files with 33 additions and 111 deletions

View File

@@ -753,23 +753,9 @@ public class TestNodeComments extends EnterpriseTestApi
comment.setContent("my comment");
Comment createdComment = commentsProxy.createNodeComment(nodeRef1.getId(), comment);
{
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
repoService.lockNode(nodeRef1);
return null;
}
}, person11.getId(), network1.getId());
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person11.getId()));
Comment updatedComment = new Comment();
updatedComment.setContent(null);
commentsProxy.updateNodeComment(nodeRef1.getId(), createdComment.getId(), updatedComment);
}
Comment updatedComment = new Comment();
updatedComment.setContent(null);
commentsProxy.updateNodeComment(nodeRef1.getId(), createdComment.getId(), updatedComment);
fail();
}
@@ -778,9 +764,15 @@ public class TestNodeComments extends EnterpriseTestApi
assertEquals(HttpStatus.SC_BAD_REQUEST, e.getHttpResponse().getStatusCode());
}
// locked node comments
// locked node - cannot add/edit/delete comments (MNT-14945, MNT-16446)
try
{
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person11.getId()));
Comment comment = new Comment();
comment.setContent("my comment");
Comment createdComment = commentsProxy.createNodeComment(nodeRef1.getId(), comment);
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
{
@Override
@@ -801,10 +793,18 @@ public class TestNodeComments extends EnterpriseTestApi
commentsProxy.getNodeComments(nodeRef1.getId(), createParams(paging, null));
// test POST for a locked node
try
{
comment = new Comment();
comment.setContent("my other comment");
createdComment = commentsProxy.createNodeComment(nodeRef1.getId(), comment);
Comment comment = new Comment();
comment.setContent("my comment");
Comment createdComment = commentsProxy.createNodeComment(nodeRef1.getId(), comment);
fail("");
}
catch(PublicApiException e)
{
assertEquals(HttpStatus.SC_FORBIDDEN, e.getHttpResponse().getStatusCode());
}
// test PUT for a locked node
{