Creating User and Permissions for user through Program | Community
Skip to main content
manikanta_jana
New Participant
October 16, 2015
Solved

Creating User and Permissions for user through Program

  • October 16, 2015
  • 3 replies
  • 1056 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Runal_Trivedi

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

3 replies

Runal_Trivedi
Runal_TrivediAccepted solution
New Participant
October 16, 2015

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

Lokesh_Shivalingaiah
New Participant
October 16, 2015
Lokesh_Shivalingaiah
New Participant
October 16, 2015