can i retrieve the users list and along with their group names in query builder? | Community
Skip to main content
Var
Level 4
January 21, 2017
Solved

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

  • January 21, 2017
  • 7 replies
  • 10585 views

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.

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 vjetty

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! 

7 replies

smacdonald2008
Level 10
January 21, 2017

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

Var
VarAuthor
Level 4
January 23, 2017

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

April 6, 2017

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

vjetty
vjettyAccepted solution
Level 4
April 6, 2017

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! 

Var
VarAuthor
Level 4
April 6, 2017

HI Krishna,

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

~VAr

Var
VarAuthor
Level 4
April 6, 2017

Good one Vamsi

April 6, 2017

Thanks a lot Vamsi. I will look into this.