cancel
Showing results for 
Search instead for 
Did you mean: 

How do i check permission of a document?

tiger_
Champ on-the-rise
Champ on-the-rise

i want to check permission on a document(like folder) through pragmatically.how do i get all permission on a document like read,write.is there any API.

Thanks in advance.

2 REPLIES 2

tiger_
Champ on-the-rise
Champ on-the-rise

Document doc =documents.get(0);

Anurag_Kumar
Confirmed Champ
Confirmed Champ

Here is the REST API you can use to check Permission on a doc:

http://localhost:8080/nuxeo/site/api/v1/path/<Folder_Path>/@acl

ex : http://localhost:8080/nuxeo/site/api/v1/path/default-domain/workspaces/@acl this gives me a json which contains permission info on Folder workspaces.

for setting permission you need to use Nuxeo Automation Client. below is the code snippet for the same: 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/docName).execute(); documentService.setPermission(root, userName/groupName, "Read");