Skip to main content

Day 20: Working with User and Groups in AEM


AEM Developer Series

Hello everyone, welcome to the last day of this basic developer series. Today we are going to look into the Users/Groups API that can be used to get the information about all the users and groups present in the JCR.

For this, we will be using org.apache.jackrabbit.api.security.user.UserManager API which looks for all the users and groups in the JCR.

User Component

To list all the users and groups on the page, we will be creating a cq:Component and it will search in the JCR to get all the data.
  • Create component User with the following configuration
User Component
  • Rename the user.jsp to user.html and paste the following code in it.
  • Here we are iterating the list of users and groups and displaying their IDs.
  • Now create a class named UserComponent and paste the following code in it.
  • Here we are creating two lists containing users' and groups' IDs
  • Deploy the code and drag & drop the component on the page. All the IDs will be listed as follows
Users and Groups

Conclusion

Congratulations!! 🙋 today we saw a programmatic approach to the UserManager API and listed users and groups through it. I hope you enjoyed this post.

You can find the complete code of this project on my GitHub in this commit. Feel free to fork or open issues, if any.

I would love to hear your thoughts on this and would like to have suggestions from you to make it better. 

Feel free to befriend me on FacebookTwitter or Linked In or say Hi by email.

Happy Coding 😊


Comments

Popular posts from this blog

Day 00: AEM Developer Series

Hello everyone! Welcome to this AEM development series. We can all see that the revolution of Digital Marketing today. Companies are dying to be a part of it and they have made this a war for the Digital Marketing tools.

Adobe was way ahead in this war and have gained a lot of market capture. They are leaders in the Digital Marketing platforms since the 2014-15. One of the flagship product in its Digital Marketing suite is Adobe Experience Manager (AEM).

Since AEM is in huge demand, the people who know how to develop on AEM are also in huge demand. But developing on AEM is not easy as it is made up of various open-source technologies such as Apache Felix (OSGi), Apache Sling, Apache Oak and Adobe's own technologies like Granite, HTL etc. Learning all these technologies in conjunction can sometimes become confusing and frustrating 😫.

When I first started learning AEM in 2016, I was dumbfounded to see there is so much going on under the hood. I then spent months to gather all the …

Day 01: Introduction to AEM

Day 04: Developing first OSGi bundle