getting groups names in a dropdown
Hi All,
I have a requirement to get all groups name stored in CQ and displaying them in a dropdown.
PLease help
Hi All,
I have a requirement to get all groups name stored in CQ and displaying them in a dropdown.
PLease help
Hi Gayane,
In CQ you can retrieve groups by calling
out.print("<select>"); Iterator<Group> groups = resolver.adaptTo(UserManager.class).getGroups(); while(groups.hasNext()) { Group group = groups.next(); out.print("<option>" + group.getName() + "</option>"); } out.print("</select>");Later in your code your could iterate through the Groups to display the neccessary information in your dropdown. resolver variable is ResourceResolver with admin permissions
Usefull links:
https://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/security/UserManager.html
https://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/security/Group.html
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.