Hi I need a extract of all the users in a particular group in AEM. Please assist.
Solved! Go to Solution.
Views
Replies
Total Likes
If you install ACS Commons, It is providing a report generator - users-to-csv-exporter.html
https://localhost:4502/etc/acs-commons/exporters/users-to-csv-exporter.html
once you download the excel, you can filter based on the group name
AEM doesn't have such an inbuilt utility to extract user's information.
You can use acs-commons https://adobe-consulting-services.github.io/acs-aem-commons/features/exporters/users/index.html
Brijesh Sir,
I recently developed a Groovy scripts that can fetch a User data based on Its' group. Also built the AEM component for the same.
Regards
Anand Shekhar
mport org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.api.security.user.UserManager;
import java.util.Iterator;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
def resourceResolverFactory = getService("org.apache.sling.api.resource.ResourceResolverFactory")
def resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
UserManager userManager = resourceResolver.adaptTo(UserManager.class);
def authorizable= userManager.getAuthorizable("<<Group-Name>>");
Group group = (org.apache.jackrabbit.api.security.user.Group) authorizable;
Node node = resourceResolver.adaptTo(Node.class);
int count = 1;
Iterator itr = group.getMembers();
if (itr.hasNext()){
println 'hello'
while(itr.hasNext()) {
String valText="";
Object obj = itr.next();
if(obj instanceof User) {
User user = (User) obj;
node = resourceResolver.getResource(user.getPath()).adaptTo(Node.class);
String nodePathStr = user.getPath().toString();
if (node.hasProperty("jcr:primaryType")){
String val_primaryType = node.getProperty("jcr:primaryType").getString();
if(val_primaryType.equals("rep:User")){
if(node.hasProperty("rep:principalName")){
valText=node.getProperty("rep:principalName").getString();
}
if(node.hasNode("profile")){
if(node.hasProperty("./profile/familyName")){
valText="User ID : "+valText+",... Last Name : "+node.getProperty("./profile/familyName").getString();
}
if(node.hasProperty("./profile/givenName")){
valText=valText+",... First Name : "+node.getProperty("./profile/givenName").getString();
}
if(node.hasProperty("./profile/email")){
valText=valText+",... Email : "+node.getProperty("./profile/email").getString();
}
if(nodePathStr!=null){
valText =valText+"... Node Path : "+nodePathStr;
}
}
}
println count +" " +valText;
count++;
}
}
}
}
If you install ACS Commons, It is providing a report generator - users-to-csv-exporter.html
https://localhost:4502/etc/acs-commons/exporters/users-to-csv-exporter.html
once you download the excel, you can filter based on the group name
Hi @ranadyutis95334 ,
Have you tried ACS User Exporter?
Link: https://adobe-consulting-services.github.io/acs-aem-commons/features/exporters/users/index.html
Navigate to http://localhost:4502/miscadmin#/etc/acs-commons/exporters and create a new Users to CSV Export page.
Name the page appropriately as the page’s report configuration can be saved and run again later.
Optionally, click Save Configuration at the top to save this configuration to this page. Multiple User to CSV Exporter pages with different configurations can be created.
Regards,
Santosh
Views
Likes
Replies
Views
Likes
Replies