Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

can i retrieve the users list and along with their group names in query builder?

Avatar

Level 5
Level 5

Am using a query debug url for listing out the users and their groups names in a json format link.

The following code snippet is giving me the users list.

p.hits=selective p.limit=-1 p.properties=rep:authorizableId rep:externalId path=/home/users type=rep:User p.properties=jcr:path

and the url JSON link  me the JSON out put of the same.

Now i want to get filter/club the Users list along with group name (or groups list along with members), will it be possible? The resulted JSON i want to use in some exports for other activities.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi, Krishna

Here I created a sample utility that do the job. Just try it if you just want to export which user belongs to which group. It has some other features as well. 

https://github.com/vamsijetty/useradmin-utility.git

       /**
         * Make sure you create a system user (using /crx/explorer) and give proper permissions to it. 
         * After you successfully create system user (For Ex: local-service-user) please Map that user to your service in 
         * Apache Sling Service User Mapper Service. 
         * Eg.: "com.handsonaem.vamsijetty.useradminutility.core:localservice=local-service-user"
         */

Hope this helps! 

View solution in original post

7 Replies

Avatar

Level 5
Level 5

smacdonald2008 wrote...

Why not use the User Manager API to retrieve user and group data and encode the result to JSON

https://jackrabbit.apache.org/api/2.0/org/apache/jackrabbit/api/security/user/UserManager.html

 

 

Thanks Scott, I have tried that API way it will workout but, the problem is i have to get the these user data from the production systems, where i am not recommended to deploy a bundle and get this work done, so checking for the front end way if this can be possible by any query builder ?

~VAr

Avatar

Level 1

Hey Var,

 

Any updates on if you were able to achieve this? can I get the query that you wrote. I have pretty much the same requirement as you. I need to retrieve the list of all the Users with the groups they belong to.

 

Regards,

 

Krishna

Avatar

Correct answer by
Level 4

Hi, Krishna

Here I created a sample utility that do the job. Just try it if you just want to export which user belongs to which group. It has some other features as well. 

https://github.com/vamsijetty/useradmin-utility.git

       /**
         * Make sure you create a system user (using /crx/explorer) and give proper permissions to it. 
         * After you successfully create system user (For Ex: local-service-user) please Map that user to your service in 
         * Apache Sling Service User Mapper Service. 
         * Eg.: "com.handsonaem.vamsijetty.useradminutility.core:localservice=local-service-user"
         */

Hope this helps! 

Avatar

Level 5
Level 5

HI Krishna,

Nope i didn't get a chance to work via Query debug url. we have implemented it via API route.

~VAr

Avatar

Level 1

Thanks a lot Vamsi. I will look into this.