Search in sources :

Example 1 with AllUserFacilityAttributesRemoved

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

the class AttributesManagerBlImpl method removeAllAttributes.

@Override
public void removeAllAttributes(PerunSession sess, Facility facility, boolean removeAlsoUserFacilityAttributes) throws WrongAttributeValueException, WrongReferenceAttributeValueException {
    removeAllAttributes(sess, facility);
    if (removeAlsoUserFacilityAttributes) {
        List<Attribute> userFacilityAttributes = getUserFacilityAttributesForAnyUser(sess, facility);
        if (getAttributesManagerImpl().removeAllUserFacilityAttributesForAnyUser(sess, facility)) {
            getPerunBl().getAuditer().log(sess, new AllUserFacilityAttributesRemoved(facility));
        }
        log.info("{} removed all attributes from any user on facility {}.", sess.getLogId(), facility.getId());
        for (Attribute attribute : userFacilityAttributes) attribute.setValue(null);
        List<User> facilityUsers = perunBl.getFacilitiesManagerBl().getAllowedUsers(sess, facility);
        for (User user : facilityUsers) {
            try {
                checkAttributesSemantics(sess, facility, user, userFacilityAttributes);
                checkAttributesDependencies(sess, facility, user, userFacilityAttributes);
            } catch (WrongAttributeAssignmentException ex) {
                throw new ConsistencyErrorException(ex);
            }
            for (Attribute attribute : userFacilityAttributes) {
                getAttributesManagerImpl().changedAttributeHook(sess, facility, user, new Attribute(attribute));
            }
        }
    }
}
Also used : AllUserFacilityAttributesRemoved(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllUserFacilityAttributesRemoved) ConsistencyErrorException(cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException) User(cz.metacentrum.perun.core.api.User) AllUserFacilityAttributesRemovedForFacilitiesAndUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllUserFacilityAttributesRemovedForFacilitiesAndUser) AttributeRemovedForFacilityAndUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForFacilityAndUser) AttributeSetForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser) AllAttributesRemovedForFacilityAndUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForFacilityAndUser) AttributeSetForFacilityAndUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForFacilityAndUser) AttributeRemovedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser) AllAttributesRemovedForUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUser) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)

Aggregations

AllAttributesRemovedForFacilityAndUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForFacilityAndUser)1 AllAttributesRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUser)1 AllUserFacilityAttributesRemoved (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllUserFacilityAttributesRemoved)1 AllUserFacilityAttributesRemovedForFacilitiesAndUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllUserFacilityAttributesRemovedForFacilitiesAndUser)1 AttributeRemovedForFacilityAndUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForFacilityAndUser)1 AttributeRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser)1 AttributeSetForFacilityAndUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForFacilityAndUser)1 AttributeSetForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForUser)1 Attribute (cz.metacentrum.perun.core.api.Attribute)1 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)1 User (cz.metacentrum.perun.core.api.User)1 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)1 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)1