Hello AEM Forks,
When it comes to the right access to right person, creating users is the first thing which hit our mind.
Let us see how to create users in AEM6.2.
Initially users were getting created using AccountManager API and but now this is deprecated in AEM6.2. After doing POC I came to know that “AccountManagement Service API” is extended with lot of new features.
Activation of AccountManagementService in Felix Console
Before using any OSGi Service, ideally it should be in "active" state but AccountManagement Service was in "unsatisfied" state when i checked it.
Fig- Account Management Service in Unsatisfied State |
Follow the below Steps to make this Service in active State:
Fig- Configure Day CQ Mail Service |
Fig- Turn On Less Secure Apps of gmail account |
Fig- Account Management Service is in Satisified state |
Explanation of AccountManagementService APIAccountManagementService API provide the below method to create AEM User.
Fig- requestAccount() method of AccountManagementService API |
Below are the parameters of requestAccount() method in detail:
Fig- Storing properties |
Note: I have given the example of localhost, but this will not work in other environment i.e QA/UAT. For these environments, domains will be dynamically fetched from “DAY CQ Link Externalizer” configuration from Felix console
a) memberOf
b) intermediatePath
c) confirmationPage
Fig- config path node with its properties |
Detailed explanation of above Properties:
Functionality of requestAccount() method
Fig- Flow of user creation using AccountManagementService API |
Follow the below Steps:
Fig- Highlighted property shows that the user is in disable state |
Fig- User gets the Account Verification Email |
Fig- User become Enable After Verifying the link |
Fig- User gets email for Account Creation |
But wait, below issue can screw all the happiness.
Issue : Initially I used configPath as “/etc/properties” but accountManagementService.requestAccount() will throw nullPointerException.
Solution: While checking the code,I came to know that AccountManagementService API internally using below method to get the Session object.
Fig- Service User Mapper Service Configuration |
Fig- Check the Permission of Service user |
"account manager" is a user correspond to "account-management-service" in "Apache Sling Service User Mapper Service Amendment" configuration, but account manager has only permissions for " /content".
Note: The configPath should be under "/content" or you can give any hierarchy but “account-manager” user must have the permission of that particular configPath.
"account manager" is a user correspond to "account-management-service" in "Apache Sling Service User Mapper Service Amendment" configuration, but account manager has only permissions for " /content".
Note: The configPath should be under "/content" or you can give any hierarchy but “account-manager” user must have the permission of that particular configPath.
For more such blog please visit : http://sgaem.blogspot.in
Kindly share your feedback and contact us at sgaem.blog02@gmail.com for any query.
Thanks and Happy Learning
Views
Replies
Total Likes
Hi Saurabh
Excellent share with the community.
Keep sharing your future blogs.
~kautuk
Views
Replies
Total Likes
Thanks kautuk
Views
Replies
Total Likes
Good article, just in case how do I manage different languages for the mail body for different users ?
Thanks,
Views
Replies
Total Likes
We added this to featured content!
Views
Replies
Total Likes
Hi Scott,
just in case, is the featured content available for use in 6.2 and how to implement the same ?
Thank you,
Views
Replies
Total Likes
How about translations for emails ?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies