Search in sources :

Example 1 with AttributeRemovedForHost

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

the class AttributesManagerBlImpl method removeAttributeWithoutCheck.

@Override
public boolean removeAttributeWithoutCheck(PerunSession sess, Host host, AttributeDefinition attribute) throws WrongAttributeAssignmentException {
    getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_HOST_ATTR);
    if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
        throw new WrongAttributeAssignmentException(attribute);
    boolean changed = getAttributesManagerImpl().removeAttribute(sess, host, attribute);
    if (changed) {
        getAttributesManagerImpl().changedAttributeHook(sess, host, new Attribute(attribute));
        log.info("{} removed attribute {} from host {}.", sess.getLogId(), attribute.getName(), host.getId());
        getPerunBl().getAuditer().log(sess, new AttributeRemovedForHost(new AttributeDefinition(attribute), host));
    }
    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) AttributeRemovedForHost(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForHost)

Aggregations

AttributeRemovedForHost (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForHost)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