Search in sources :

Example 1 with AttributeRemovedForResourceAndMember

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

the class AttributesManagerBlImpl method removeAttributeWithoutCheck.

@Override
public boolean removeAttributeWithoutCheck(PerunSession sess, Member member, Resource resource, AttributeDefinition attribute) throws WrongAttributeAssignmentException, WrongReferenceAttributeValueException, MemberResourceMismatchException {
    this.checkMemberIsFromTheSameVoLikeResource(sess, member, resource);
    getAttributesManagerImpl().checkNamespace(sess, attribute, NS_MEMBER_RESOURCE_ATTR);
    if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
        throw new WrongAttributeAssignmentException(attribute);
    boolean changed = getAttributesManagerImpl().removeAttribute(sess, member, resource, attribute);
    if (changed) {
        getAttributesManagerImpl().changedAttributeHook(sess, member, resource, new Attribute(attribute));
        log.info("{} removed attribute {} from member {} on resource {}.", sess.getLogId(), attribute.getName(), member.getId(), resource.getId());
        getPerunBl().getAuditer().log(sess, new AttributeRemovedForResourceAndMember(new AttributeDefinition(attribute), resource, 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) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) AttributeRemovedForResourceAndMember(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForResourceAndMember)

Aggregations

AttributeRemovedForResourceAndMember (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForResourceAndMember)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 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)1