AEM Developer Series
- Day 00: AEM Developer Series
- Day 01: Introduction to AEM
- Day 02: AEM Architecture
- Day 03: Setting up AEM Development Environment
- Day 04: Developing First OSGi Bundle
- Day 05: Working with Sling Servlets in AEM
- Day 06: Playing with Sling Post Servlet
- Day 07: Creating your first component in AEM
- Day 09: Dueling with Java User API
- Day 10: Getting to know Sling Models
- Day 11: Client Libraries in Action
- Day 12: Creating your custom OSGi Configuration
- Day 13: Schedulers in AEM
- Day 14: Eventing in AEM
- Day 15: Custom Workflows in AEM
- Day 16: Creating JMX Beans in AEM
- Day 17: Working with QueryBuilder API
- Day 18: Working with Granite Datasources in AEM
- Day 19: Replication API in Action
- Day 20: Working with Users and Groups in AEM
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.
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
- 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|
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.
Happy Coding 😊