use of cz.metacentrum.perun.audit.events.GroupManagerEvents.IndirectMemberAddedToGroup in project perun by CESNET.
the class GroupsManagerBlImpl method addIndirectMembers.
/**
* Add records of the members with an INDIRECT membership type to the group.
*
* @param sess perun session
* @param group group to add members to
* @param members list of members to add as INDIRECT
* @param sourceGroupId id of a group from which members originate
* @return list of members that were not members already
* @throws InternalErrorException
* @throws AlreadyMemberException
* @throws WrongAttributeValueException
* @throws WrongReferenceAttributeValueException
*/
protected List<Member> addIndirectMembers(PerunSession sess, Group group, List<Member> members, int sourceGroupId) throws AlreadyMemberException, WrongAttributeValueException, WrongReferenceAttributeValueException {
lockGroupMembership(group, members);
List<Member> newMembers = new ArrayList<>();
for (Member member : members) {
// we want to process only newly added members
if (!isGroupMember(sess, group, member))
newMembers.add(member);
groupsManagerImpl.addMember(sess, group, member, MembershipType.INDIRECT, sourceGroupId);
}
for (Member member : newMembers) {
setRequiredAttributes(sess, member, group);
getPerunBl().getAuditer().log(sess, new IndirectMemberAddedToGroup(member, group));
}
return newMembers;
}
Aggregations