use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForGroupAndResource in project perun by CESNET.
the class AttributesManagerBlImpl method setAttributeWithoutCheck.
@Override
public boolean setAttributeWithoutCheck(PerunSession sess, Resource resource, Group group, Attribute attribute) throws WrongAttributeAssignmentException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupResourceMismatchException {
this.checkGroupIsFromTheSameVoLikeResource(sess, group, resource);
getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_GROUP_RESOURCE_ATTR);
if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
throw new WrongAttributeAssignmentException(attribute);
boolean changed;
if (isVirtAttribute(sess, attribute)) {
// FIXME Zatim je zakazane nastavovani virtualnich atributu group_resource
Attribute storedAttribute;
try {
storedAttribute = getAttribute(sess, resource, group, attribute.getName());
} catch (AttributeNotExistsException ex) {
throw new ConsistencyErrorException(ex);
}
if (!(storedAttribute.getValue() == null ? attribute.getValue() == null : storedAttribute.getValue().equals(attribute.getValue()))) {
// FIXME
if (attribute.getName().equals(AttributesManager.NS_GROUP_RESOURCE_ATTR_VIRT + ":unixGID") || attribute.getName().equals(AttributesManager.NS_GROUP_RESOURCE_ATTR_VIRT + ":unixGroupName")) {
return getAttributesManagerImpl().setVirtualAttribute(sess, resource, group, attribute);
} else {
throw new InternalErrorException("Virtual attribute can't be set this way yet. Please set physical attribute. " + attribute);
}
} else {
return false;
}
} else {
changed = getAttributesManagerImpl().setAttribute(sess, resource, group, attribute);
}
if (changed) {
getPerunBl().getAuditer().log(sess, new AttributeSetForGroupAndResource(attribute, group, resource));
getAttributesManagerImpl().changedAttributeHook(sess, resource, group, attribute);
}
return changed;
}
Aggregations