Expand my Community achievements bar.

SOLVED

Creating User and Permissions for user through Program

Avatar

Level 2

Hi,

We have a requirement that, We need to create around 200 users with different DAM folder permissions. Is there any way we can create these users and rep:policies via java program rather than useradmin. 

The  problem with useradmin approach is in our case,  One folder will have around 100 sub level folders and we need to create each user with each sublevel folder. In this scenario, When i select parent folder it automatically selects the sublevel folders(around 100) and deselecting the other 99 folders for one user is very tough.Our Client also not happy with this approach. 

So is there any other way we can achieve this scenario or is there any way i can implement a script with some api to create these users which will include these permissions as well. 

Thanks,

Manikanta.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You will need to use API of package javax.jcr.security to read and modify ACL's programmatically. Refer to following link for so - http://www.day.com/specs/jcr/2.0/16_Access_Control_Management.html

  •     AccessControlManager API contains method to read ACL's of a particular node, you get AccessControlManager from jcr session object.
  •     AccessControlManager.getApplicablePolicies(String absPath) give the policies for the node.
  •     From PolicyIterator get AccessControlPolicy using its API method - nextAccessControlPolicy() this returns AccessControlPolicy object, use AccessControlPolicy object to add new ACL policies to the node.

Hope it helps.

- Runal

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

You will need to use API of package javax.jcr.security to read and modify ACL's programmatically. Refer to following link for so - http://www.day.com/specs/jcr/2.0/16_Access_Control_Management.html

  •     AccessControlManager API contains method to read ACL's of a particular node, you get AccessControlManager from jcr session object.
  •     AccessControlManager.getApplicablePolicies(String absPath) give the policies for the node.
  •     From PolicyIterator get AccessControlPolicy using its API method - nextAccessControlPolicy() this returns AccessControlPolicy object, use AccessControlPolicy object to add new ACL policies to the node.

Hope it helps.

- Runal