Search in sources :

Example 1 with AllAttributesRemovedForMemberAndGroup

use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForMemberAndGroup in project perun by CESNET.

the class AttributesManagerBlImpl method removeAllAttributes.

@Override
public void removeAllAttributes(PerunSession sess, Member member, Group group) throws WrongAttributeValueException, WrongReferenceAttributeValueException, MemberGroupMismatchException {
    List<Attribute> attributes = getAttributes(sess, member, group);
    if (getAttributesManagerImpl().removeAllAttributes(sess, member, group)) {
        getPerunBl().getAuditer().log(sess, new AllAttributesRemovedForMemberAndGroup(member, group));
    }
    log.info("{} removed all attributes from member {} in group {}.", sess.getLogId(), member.getId(), group.getId());
    for (Attribute attribute : attributes) attribute.setValue(null);
    try {
        checkAttributesSemantics(sess, member, group, attributes);
        checkAttributesDependencies(sess, member, group, attributes);
    } catch (WrongAttributeAssignmentException ex) {
        throw new ConsistencyErrorException(ex);
    }
    for (Attribute attribute : attributes) {
        getAttributesManagerImpl().changedAttributeHook(sess, member, group, new Attribute(attribute));
    }
}
Also used : ConsistencyErrorException(cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) AllAttributesRemovedForMemberAndGroup(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForMemberAndGroup)

Aggregations

AllAttributesRemovedForMemberAndGroup (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForMemberAndGroup)1 Attribute (cz.metacentrum.perun.core.api.Attribute)1 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)1 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)1 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)1