Search in sources :

Example 1 with AttributeSetForFacilityAndUser

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

the class AttributesManagerBlImpl method setAttributeWithoutCheck.

@Override
public boolean setAttributeWithoutCheck(PerunSession sess, Facility facility, User user, Attribute attribute) throws WrongAttributeAssignmentException, WrongAttributeValueException {
    getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_USER_FACILITY_ATTR);
    if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
        throw new WrongAttributeAssignmentException(attribute);
    boolean changed;
    if (getAttributesManagerImpl().isVirtAttribute(sess, attribute)) {
        try {
            changed = getAttributesManagerImpl().setVirtualAttribute(sess, facility, user, attribute);
        } catch (WrongReferenceAttributeValueException ex) {
            throw new InternalErrorException(ex);
        }
    // FIXME update changed variable
    } else {
        changed = getAttributesManagerImpl().setAttribute(sess, facility, user, attribute);
    }
    if (changed) {
        getPerunBl().getAuditer().log(sess, new AttributeSetForFacilityAndUser(attribute, facility, user));
        getAttributesManagerImpl().changedAttributeHook(sess, facility, user, attribute);
    }
    return changed;
}
Also used : WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) WrongReferenceAttributeValueException(cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException) AttributeSetForFacilityAndUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForFacilityAndUser) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException)

Aggregations

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