How to get list of Users/Group with specific privileges for the given content? | Community
Skip to main content
Level 3
Oct 16, 2015 2:26 AM UTC
Solved

How to get list of Users/Group with specific privileges for the given content?

In a large organization we have multiple divisions and publishing workflow is pretty decentralized.

Is there any way how I can programmatically get a list of Users/Groups which have certain explicit (not inherited) permissions set for the given content path?

Example:

There is a "global editors" group which has REPLICATE permissions for the whole /content namespace. Another group "editors X" has REPLICATE permission set for /content/x branch. And yet another group "local editors" assigned to the /content/x/local node. How I can get only "local editors" group for the node /content/x/local? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
anjali_biddanda
anjali_biddandaAccepted solution
Level 4
Oct 6, 2020 5:05 PM UTC

You can do this: 

Authorizable userGroup = userManager.getAuthorizable("test-usergroup"); JackrabbitAccessControlManager jMgr = (JackrabbitAccessControlManager) adminSession.getAccessControlManager(); jMgr.hasPrivileges(path, Collections.singleton(userGroup.getPrincipal()), privileges);

 

8 replies

anjali_biddanda
anjali_biddandaAccepted solution
Level 4
Oct 6, 2020 5:05 PM UTC

You can do this: 

Authorizable userGroup = userManager.getAuthorizable("test-usergroup"); JackrabbitAccessControlManager jMgr = (JackrabbitAccessControlManager) adminSession.getAccessControlManager(); jMgr.hasPrivileges(path, Collections.singleton(userGroup.getPrincipal()), privileges);

 

Translate
anjali_biddanda
Level 4
Oct 6, 2020 12:26 PM UTC

Hi @jura_khrapunov , were you able to use this to solve your issue? 

userManager.findAuthorizables(path, "rep:Group")

I have the same problem. I need to know what user groups have write access to a given path. I can't use the above successfully. It only works for relative paths like 

userManager.findAuthorizables("jcr:primaryType", "rep:Group")

 @smacdonald2008 , do you have any suggestions?

Translate
Level 3
Oct 6, 2020 12:30 PM UTC

It was so long time ago, I believe I just looped over permissions at the given path and all its parents to collect the data

Translate
smacdonald2008
Level 10
Oct 16, 2015 2:26 AM UTC

To learn how to work with the jackrabbut User APIs using an AEM OSGi bundle-- see this community article:

http://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit.html

Translate
smacdonald2008
Level 10
Oct 16, 2015 2:26 AM UTC

To programmatically work with user in AEM, you use the org.apache.jackrabbit.api.security.user.UserManager api. For you use case, you can call the findAuthorizables method and set the correct properties. I will look to determine if we have code samples.

Translate
Level 3
Oct 16, 2015 2:26 AM UTC

Ok, thanks for the direction

Translate