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