Hi all,
when adding multiple users to a group became difficult with the way AEM 6.2 stores user and group nodes in Repository. Is there any easy way to add multiple users to a group ? or vice versa ? I was trying something like below and it works but does not helps for large set of user/groups.
curl -u admin:admin -FaddMembers=abc.testing http://localhost:4502/home/groups/e/e3y2nsMSdULATLrZwrp_.rw.html
So how to identify which group it belongs to unless we i do a search in repository.
Help is really appreciated !!
You can use the JackRabbit User Manager API to build custom solutions to meet requirements. Using the API, you have a lot of functionality available to you.
https://jackrabbit.apache.org/api/2.6/org/apache/jackrabbit/api/security/user/UserManager.html
I would recommend using this API over CURL commands.
Here is an artilce to get you up and running with this API:
Using Jackrabbit UserManager APIs to retrieve group permissions
Hi
For using CURL you definately need to search for a group in the repository.
If you want to add multiple users in one command, then use :-
$ curl -u admin:admin -FaddMembers=myUserName1 -FaddMembers=myUserName2 -FremoveMembers=myUserName3 -FremoveMembers=myUserName4 http://localhost:4502/home/groups/m/myGroupName.rw.html
Otherwise, create a custom service/Component that use UserManager APIs as stated by Scott:- https://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit_group.html
~kautuk
ok, Thanks for reply but still group names been saved as system generated i.e. something like this /home/groups/1/1EfrGlFhT9KTQq344Dmy, so to know 1EfrGlFhT9KTQq344Dmy belogs to which group we might need to search again. Is there any otherway that we can provide regular group name in cURL?
Views
Replies
Total Likes
chaitanyac9677 wrote...
ok, Thanks for reply but still group names been saved as system generated i.e. something like this /home/groups/1/1EfrGlFhT9KTQq344Dmy, so to know 1EfrGlFhT9KTQq344Dmy belogs to which group we might need to search again. Is there any otherway that we can provide regular group name in cURL?
Hi,
Yes you are right, so if you are aware of the group name, then use may use curl by :- FaddMembers=myUserName1 -FaddMembers=myUserName2
$ curl -u admin:admin -FaddMembers=myUserName1 -FaddMembers=myUserName2 -FremoveMembers=myUserName3 -FremoveMembers=myUserName4 http://localhost:4502/home/groups/m/myGroupName.rw.html
Otherwise, create a custom service/Component that use UserManager APIs :- https://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit_group.html
More reference articles:-
Link:- https://helpx.adobe.com/experience-manager/using/jackrabbit-users.html
Link:- http://www.tothenew.com/blog/creating-user-profile-in-aem/
ResourceResolver resolver=request.getResourceResolver();
Session session=request.getResourceResolver().adaptTo(Session.class);
UserManager userManager = resolver.adaptTo(UserManager.class);
Group group=userManager.createGroup(" Group Name"); //Creating a group
User user=userManager.createUser("username",”pwd”);
if (! userManager.isAutoSave()) {
session.save();
}
I hope this would help you.
~kautuk
Views
Replies
Total Likes
kautuksahni wrote...
![]()
chaitanyac9677 wrote...
ok, Thanks for reply but still group names been saved as system generated i.e. something like this /home/groups/1/1EfrGlFhT9KTQq344Dmy, so to know 1EfrGlFhT9KTQq344Dmy belogs to which group we might need to search again. Is there any otherway that we can provide regular group name in cURL?
Hi,
Yes you are right, so if you are aware of the group name, then use may use curl by :- FaddMembers=myUserName1 -FaddMembers=myUserName2
$ curl -u admin:admin -FaddMembers=myUserName1 -FaddMembers=myUserName2 -FremoveMembers=myUserName3 -FremoveMembers=myUserName4 http://localhost:4502/home/groups/m/myGroupName.rw.html
Otherwise, create a custom service/Component that use UserManager APIs :- https://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit_group.html
More reference articles:-
Link:- https://helpx.adobe.com/experience-manager/using/jackrabbit-users.html
Link:- http://www.tothenew.com/blog/creating-user-profile-in-aem/
ResourceResolver resolver=request.getResourceResolver();
Session session=request.getResourceResolver().adaptTo(Session.class);
UserManager userManager = resolver.adaptTo(UserManager.class);
Group group=userManager.createGroup(" Group Name"); //Creating a group
User user=userManager.createUser("username",”pwd”);
if (! userManager.isAutoSave()) {
session.save();
}
I hope this would help you.
~kautuk
I think that chaitanyac9677's point is that new Groups that are created also fall under the RandomAuthorizableNodeName[1] class, as seen in this forum post[2].
For example, just created a group in my local AEM 6.2 instance named "test-group-1" and it was created here:
/home/groups/x/xPtfdxC2HwFwwdzDPKb2 [test-group-1]
So technically knowing the group name doesn't really do anything for you unless you also know the group path. :(
[1] https://jackrabbit.apache.org/oak/docs/apidocs/index.html?org/apache/jackrabbit/oak/security/user/Ra...
[2] http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...