How to set permanent permission with Java API?

I am trying to assign a permanent permission to a group but I got null pointer exception when begin or end dates are not defined.

ACE ace = new ACE();
ace.setUsername(username);
ace.setPermission("Everything");
ace.setCreator(nuxeologin);
ace.setBlockInheritance(true);
newFolder.addPermission(ace);
```
Exception in thread "main" java.lang.NullPointerException
    at org.nuxeo.client.api.objects.acl.ACE.getBeginAsString(ACE.java:152)
    at org.nuxeo.client.api.objects.Document.setPermissionAutomationParameters(Document.java:422)
    at org.nuxeo.client.api.objects.Document.addPermission(Document.java:416)

how can I do this?

Tks

0 votes

2 answers

128 views

ANSWER



Hi,

Thanks for your feedback! I've created the following issue to track the bug.

0 votes



I have found a way by passing the add permission call and going directly to nuxeoClient

Map<String, Object> params = new HashMap<>();
params.put("user", ace.getUsername());
params.put("permission", ace.getPermission());
params.put("creator", ace.getCreator());
params.put("blockInheritance", ace.isBlockInheritance());
params.put("comment", ace.getComment());
params.put("notify", ace.isNotify());
nuxeoClient.automation("Document.AddPermission").input(newFolder).parameters(params).execute();
0 votes