Search in sources :

Example 1 with AttributeRemovedForMember

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

the class AttributesManagerBlImpl method removeAttributeWithoutCheck.

@Override
public boolean removeAttributeWithoutCheck(PerunSession sess, Member member, AttributeDefinition attribute) throws WrongAttributeAssignmentException {
    getAttributesManagerImpl().checkNamespace(sess, attribute, NS_MEMBER_ATTR);
    if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
        throw new WrongAttributeAssignmentException(attribute);
    boolean changed = getAttributesManagerImpl().removeAttribute(sess, member, attribute);
    if (changed) {
        try {
            getAttributesManagerImpl().changedAttributeHook(sess, member, new Attribute(attribute));
        } catch (WrongReferenceAttributeValueException ex) {
            throw new InternalErrorException(ex);
        }
        log.info("{} removed attribute {} from member {}.", sess.getLogId(), attribute.getName(), member.getId());
        getPerunBl().getAuditer().log(sess, new AttributeRemovedForMember(new AttributeDefinition(attribute), member));
    }
    return changed;
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) WrongReferenceAttributeValueException(cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException) AttributeRemovedForMember(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForMember) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException)

Aggregations

AttributeRemovedForMember (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForMember)1 Attribute (cz.metacentrum.perun.core.api.Attribute)1 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)1 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)1 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)1 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)1 WrongReferenceAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException)1