cancel
Showing results for 
Search instead for 
Did you mean: 

How to set permanent permission with Java API?

Avi_Jain
Champ in-the-making
Champ in-the-making

I am trying to assign a permanent permission to a group but in nuxeo permission is not working and it is not assigning to any user. My Code is:

String url = "http://localhost:8080/nuxeo"; NuxeoClient nuxeoClient = new NuxeoClient(url, "Administrator", "Administrator"); org.nuxeo.client.api.objects.Document pathDoc = nuxeoClient.repository().fetchDocumentById(docId); GregorianCalendar begin = new GregorianCalendar(2015, Calendar.JUNE, 20, 12, 34, 56); GregorianCalendar end = new GregorianCalendar(2015, Calendar.JULY, 14, 12, 34, 56); ACE ace = new ACE(); ace.setUsername("user0"); ace.setPermission("Write"); ace.setCreator("Administrator"); ace.setBegin(begin); ace.setEnd(end); ace.setBlockInheritance(true); pathDoc.addPermission(ace);

How can I do this..? Please help me I dont have any other support. Thanks for your support. It will be really helpful for me as I m doing this task since 10 days.

6 REPLIES 6

Kevin_Leturc
Star Contributor
Star Contributor

Hi,

I don't understand why you're setting a begin and end date in 2015 for a permanent permission. The added permission won't be activated because the date period is over.

You seem to use the 2.x java client, the supported version is 3.x which works with all Nuxeo version starting from LTS 2016 - 7.10.

If you can use 3.x, you'll be able to not set begin/end date to make a permanent permission.

Otherwise, there's a bug on permanent permission in 2.x, you'll need to workaround it. You can follow https://answers.nuxeo.com/general/q/3671a1cd542144219426b315a0fb71a0/How-to-set-permanent-permission... or set an end date in future, in 2100 for instance.

Hello,

I just tried this test with latest nuxeo java client version (3.0.2-SNAPSHOT) and everything works

I want to give permission in nuxeo through nuxeo api. i tried using this following code u wrote above. But I didn't work for me. In backend nuxeo Ui, I can't see the following permission which i have given to specific user.

Hi,

Okay I'll try this way. and will sent u logs regarding this.