use of org.gluu.oxtrust.model.GluuGroup in project oxTrust by GluuFederation.
the class ServiceUtil method groupMembersAdder.
/**
* Adds a person to a group
*
* @return void
* @throws Exception
*/
public void groupMembersAdder(GluuCustomPerson gluuPerson, String dn) throws Exception {
List<String> groups = gluuPerson.getMemberOf();
for (String group : groups) {
GluuGroup oneGroup = groupService.getGroupByDn(group);
List<String> groupMembers = oneGroup.getMembers();
if ((groupMembers != null && !groupMembers.isEmpty()) && !isMemberExist(groupMembers, dn)) {
List<String> cleanGroupMembers = new ArrayList<String>();
cleanGroupMembers.add(dn);
for (String personDN : groupMembers) {
cleanGroupMembers.add(personDN);
}
oneGroup.setMembers(cleanGroupMembers);
groupService.updateGroup(oneGroup);
}
}
}
Aggregations