cancel
Showing results for 
Search instead for 
Did you mean: 

How to set permanent permission with Java API?

Eduardo_Rodrigu
Champ on-the-rise
Champ on-the-rise

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

2 REPLIES 2

Eduardo_Rodrigu
Champ on-the-rise
Champ on-the-rise

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();

Thomas_Roger
Star Contributor
Star Contributor

Hi,

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