use of cz.metacentrum.perun.audit.events.MembersManagerEvents.MemberValidated in project perun by CESNET.
the class urn_perun_member_attribute_def_def_suspensionInfo method resolveVirtualAttributeValueChange.
@Override
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl session, AuditEvent message) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException {
Member member = null;
if (message instanceof MemberValidated) {
member = ((MemberValidated) message).getMember();
} else if (message instanceof MemberDisabled) {
member = ((MemberDisabled) message).getMember();
} else if (message instanceof MemberExpired) {
member = ((MemberExpired) message).getMember();
}
clearSuspensionInfo(session, member);
return new ArrayList<>();
}
use of cz.metacentrum.perun.audit.events.MembersManagerEvents.MemberValidated in project perun by CESNET.
the class MembersManagerBlImpl method validateMember.
@Override
public Member validateMember(PerunSession sess, Member member) throws WrongAttributeValueException, WrongReferenceAttributeValueException {
// this method run in nested transaction
if (this.haveStatus(sess, member, Status.VALID)) {
log.debug("Trying to validate member who is already valid. " + member);
return member;
}
Status oldStatus = member.getStatus();
getMembersManagerImpl().setStatus(sess, member, Status.VALID);
member.setStatus(Status.VALID);
getPerunBl().getAuditer().log(sess, new MemberValidated(member));
if (oldStatus.equals(Status.INVALID) || oldStatus.equals(Status.DISABLED)) {
try {
getPerunBl().getAttributesManagerBl().doTheMagic(sess, member);
} catch (Exception ex) {
// return old status to object to prevent incorrect result in higher methods
member.setStatus(oldStatus);
throw ex;
}
}
return member;
}
Aggregations