use of cz.metacentrum.perun.audit.events.MembersManagerEvents.SponsorshipRemoved in project perun by CESNET.
the class MembersManagerBlImpl method unsetSponsorshipForMember.
@Override
public Member unsetSponsorshipForMember(PerunSession session, Member sponsoredMember) throws MemberNotSponsoredException {
if (!sponsoredMember.isSponsored()) {
throw new MemberNotSponsoredException(sponsoredMember + " is not sponsored member!");
}
// set member to be sponsored
List<User> sponsors = getPerunBl().getUsersManagerBl().getSponsors(session, sponsoredMember);
sponsoredMember = getMembersManagerImpl().unsetSponsorshipForMember(session, sponsoredMember);
getPerunBl().getAuditer().log(session, new SponsoredMemberUnset(sponsoredMember));
for (User sponsor : sponsors) {
getPerunBl().getAuditer().log(session, new SponsorshipRemoved(sponsoredMember, sponsor));
}
return sponsoredMember;
}
use of cz.metacentrum.perun.audit.events.MembersManagerEvents.SponsorshipRemoved in project perun by CESNET.
the class MembersManagerBlImpl method removeSponsor.
@Override
public void removeSponsor(PerunSession sess, Member sponsoredMember, User sponsorToRemove) {
getMembersManagerImpl().removeSponsor(sess, sponsoredMember, sponsorToRemove);
getPerunBl().getAuditer().log(sess, new SponsorshipRemoved(sponsoredMember, sponsorToRemove));
// check if the user was the last sponsor
Vo vo = getMemberVo(sess, sponsoredMember);
boolean hasSponsor = false;
for (User sponsor : getPerunBl().getUsersManagerBl().getSponsors(sess, sponsoredMember)) {
if (getPerunBl().getVosManagerBl().isUserInRoleForVo(sess, sponsor, Role.SPONSOR, vo, true)) {
hasSponsor = true;
break;
}
}
if (!hasSponsor) {
processMemberAfterRemovingLastSponsor(sess, sponsoredMember, vo);
}
}
Aggregations