How to grant access to group to folder using REST API
Hi
I cannot find in the playground nor in the endpoints a way to add or remove a group from a folder/workspace ACL using the REST API
what's the endpoint to add a group to a single folder?
I can change the folder definition but that applies to every folder, instead I'd want a different group having access to it's own tree of documents all managed programatically.
when I try adding a local permission to the file using the management interface and get the file using the ID api, there is no local permission node into the document, so I can't edit it trough that particular endpoint, i.e.
GET nuxeo/site/api/v1/id/99762585-53b7-4276-9a1c-bffeaca7d448
{"entity-type":"document","repository":"default","uid":"99762585-53b7-4276-9a1c-bffeaca7d448",
"path":"/default-domain/workspaces/data","type":"Workspace","state":"project","parentRef":
"7edb2187-348a-49c2-9ecf-1b767c856cc9","versionLabel":"","isCheckedOut":true,"title":"data",
"lastModified":"2015-02-24T15:00:28.00Z","facets":
["SuperSpace","Folderish"],"changeToken":"1424790028000","contextParameters":{}}
This may solve your problem:
HttpAutomationClient autoclient = new HttpAutomationClient(“http://localhost:8080/nuxeo/site/automation”);
Session session = autoclient.getSession(“user”, “password”);
DocumentService documentService = new DocumentService(session);
Document root = (Document) session.newRequest(“Document.Fetch”).set(“value”, /docPath).execute();
documentService.setPermission(root, userName/groupName, “Read”);