Print 'key' in ReadOnlyAttributeUnchangedValidator failure log message

This change is quite useful for debugging and helps identify which specific attribute makes the update fail. Currently, the full pattern is printed which consists of multiple attributes.
This commit is contained in:
Adeel Ahmad 2023-08-16 11:20:37 +02:00 committed by Pedro Igor
parent 7707efae57
commit 4f90124612

View file

@ -82,7 +82,7 @@ public class ReadOnlyAttributeUnchangedValidator implements SimpleValidator {
}
if (!isUnchanged(existingValue, value)) {
logger.warnf("Attempt to edit denied attribute '%s' of user '%s'", pattern, user == null ? "new user" : user.getFirstAttribute(UserModel.USERNAME));
logger.warnf("Attempt to edit denied for attribute '%s' with pattern '%s' of user '%s'", key, pattern, user == null ? "new user" : user.getFirstAttribute(UserModel.USERNAME));
context.addError(new ValidationError(ID, key, UPDATE_READ_ONLY_ATTRIBUTES_REJECTED_MSG));
}