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));
}
}
}
}
Aggregations