Search in sources :

Example 1 with AllUserFacilityAttributesRemovedForFacilitiesAndUser

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

the class AttributesManagerBlImpl method removeAllUserFacilityAttributes.

@Override
public void removeAllUserFacilityAttributes(PerunSession sess, User user) throws WrongAttributeValueException, WrongReferenceAttributeValueException {
    List<RichAttribute<User, Facility>> userFacilitiesAttributes = getAttributesManagerImpl().getAllUserFacilityRichAttributes(sess, user);
    // remove all non-virtual attributes
    if (getAttributesManagerImpl().removeAllUserFacilityAttributes(sess, user)) {
        getPerunBl().getAuditer().log(sess, new AllUserFacilityAttributesRemovedForFacilitiesAndUser(user));
    }
    log.info("{} removed all attributes from user {} on all facilities.", sess.getLogId(), user.getId());
    for (RichAttribute<User, Facility> richAttribute : userFacilitiesAttributes) {
        try {
            checkAttributeSemantics(sess, richAttribute.getSecondaryHolder(), richAttribute.getPrimaryHolder(), new Attribute(richAttribute.getAttribute()));
            checkAttributeDependencies(sess, richAttribute);
        } catch (WrongAttributeAssignmentException ex) {
            throw new ConsistencyErrorException(ex);
        }
    }
    for (RichAttribute<User, Facility> attribute : userFacilitiesAttributes) {
        getAttributesManagerImpl().changedAttributeHook(sess, attribute.getSecondaryHolder(), attribute.getPrimaryHolder(), new Attribute(attribute.getAttribute()));
    }
}
Also used : 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) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) AllUserFacilityAttributesRemovedForFacilitiesAndUser(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllUserFacilityAttributesRemovedForFacilitiesAndUser) AttributeRemovedForFacility(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForFacility) Facility(cz.metacentrum.perun.core.api.Facility) AttributeSetForFacility(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForFacility)

Aggregations

AllAttributesRemovedForFacilityAndUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForFacilityAndUser)1 AllAttributesRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForUser)1 AllUserFacilityAttributesRemovedForFacilitiesAndUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllUserFacilityAttributesRemovedForFacilitiesAndUser)1 AttributeRemovedForFacility (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForFacility)1 AttributeRemovedForFacilityAndUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForFacilityAndUser)1 AttributeRemovedForUser (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForUser)1 AttributeSetForFacility (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForFacility)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 Facility (cz.metacentrum.perun.core.api.Facility)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