diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java index cd7a68c0983d..1ca788b13886 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java @@ -578,7 +578,7 @@ public UserUpdater(User original, User updated, Operation operation) { @Override public void entitySpecificUpdate() { // LowerCase Email - updated.setEmail(updated.getEmail().toLowerCase()); + updated.setEmail(original.getEmail().toLowerCase()); // Updates updateRoles(original, updated); @@ -590,7 +590,6 @@ public void entitySpecificUpdate() { recordChange("timezone", original.getTimezone(), updated.getTimezone()); recordChange("isBot", original.getIsBot(), updated.getIsBot()); recordChange("isAdmin", original.getIsAdmin(), updated.getIsAdmin()); - recordChange("email", original.getEmail(), updated.getEmail().toLowerCase()); recordChange("isEmailVerified", original.getIsEmailVerified(), updated.getIsEmailVerified()); updateAuthenticationMechanism(original, updated); } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java index 13b934e3b46f..05b023855293 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java @@ -305,13 +305,13 @@ void put_validUser_200_ok() throws IOException { // Update the user information using PUT String oldEmail = create.getEmail(); + // Even with new field being updated, this shouuld not take effect CreateUser update = create.withEmail("user.xyz@email.com").withDisplayName("displayName1"); ChangeDescription change = getChangeDescription(user, MINOR_UPDATE); fieldAdded(change, "displayName", "displayName1"); - fieldUpdated(change, "email", oldEmail, "user.xyz@email.com"); user = updateAndCheckEntity(update, OK, ADMIN_AUTH_HEADERS, MINOR_UPDATE, change); - + assertEquals(oldEmail, user.getEmail()); // Update the user information using PUT as the logged-in user update = create.withDisplayName("displayName2"); change = getChangeDescription(user, MINOR_UPDATE);