Search in sources :

Example 1 with AttributeRemovedForGroupAndResource

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

the class AttributesManagerBlImpl method removeAttributeWithoutCheck.

@Override
public boolean removeAttributeWithoutCheck(PerunSession sess, Resource resource, Group group, AttributeDefinition attribute) throws WrongAttributeAssignmentException, GroupResourceMismatchException {
    this.checkGroupIsFromTheSameVoLikeResource(sess, group, resource);
    getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_GROUP_RESOURCE_ATTR);
    boolean changed;
    if (this.isVirtAttribute(sess, attribute)) {
        changed = getAttributesManagerImpl().removeVirtualAttribute(sess, resource, group, attribute);
    } else {
        changed = getAttributesManagerImpl().removeAttribute(sess, resource, group, attribute);
    }
    if (changed)
        getAttributesManagerImpl().changedAttributeHook(sess, resource, group, new Attribute(attribute));
    if (changed)
        log.info("{} removed attribute {} from group {} on resource {}.", sess.getLogId(), attribute.getName(), group.getId(), resource.getId());
    getPerunBl().getAuditer().log(sess, new AttributeRemovedForGroupAndResource(new AttributeDefinition(attribute), group, resource));
    return changed;
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) AttributeRemovedForGroupAndResource(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForGroupAndResource) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Aggregations

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