Get group members properties
-
13-12-2019 - |
Question
I need to fetch in my JavaDelegate class properties of some user which is member of some group.
When i have node ref to the user i can fetch his properties on this way for example
QName PROP_QNAME_EMAIL = QName.createQName("http://www.alfresco.org/model/content/1.0", "email");
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
properties.get(PROP_QNAME_EMAIL);
But the problem is now that i only have GROUP NAME, and i don't know how to get NodeRef of the user which is in that group? Any help on this?
Regards, Aleksandar
Solution
In mean time i succeeded to done this. Solution is:
Set<String> authorities = authorityService.getContainedAuthorities(AuthorityType.USER, p_groupName, false);
for (final String authority : authorities) {
final NodeRef person = personService.getPerson(authority);
final Map<QName, Serializable> properties = nodeService.getProperties(person);
properties.get(ContentModel.PROP_EMAIL).toString());
}
In this example i fetch email for every group member.
Regards, Aleksandar
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow