diff --git a/bootstrap/sql/migrations/native/1.4.7/mysql/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.4.7/mysql/postDataMigrationSQLScript.sql index 789cbbd4fc9..43c82c5602d 100644 --- a/bootstrap/sql/migrations/native/1.4.7/mysql/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.4.7/mysql/postDataMigrationSQLScript.sql @@ -19,3 +19,5 @@ SET json = JSON_SET( '$.fullyQualifiedName', LOWER(JSON_UNQUOTE(JSON_EXTRACT(json, '$.fullyQualifiedName'))) ); + +UPDATE user_entity SET nameHash = MD5(JSON_UNQUOTE(JSON_EXTRACT(json, '$.fullyQualifiedName'))); diff --git a/bootstrap/sql/migrations/native/1.4.7/postgres/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.4.7/postgres/postDataMigrationSQLScript.sql index 46b5038286f..f36807a0950 100644 --- a/bootstrap/sql/migrations/native/1.4.7/postgres/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.4.7/postgres/postDataMigrationSQLScript.sql @@ -18,4 +18,6 @@ SET json = jsonb_set( json, '{fullyQualifiedName}', to_jsonb(LOWER(json->>'fullyQualifiedName')) -); \ No newline at end of file +); + +UPDATE user_entity SET nameHash = MD5(json ->> 'fullyQualifiedName'); \ No newline at end of file diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java index b30cf1139ab..e954b07a65b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java @@ -568,14 +568,14 @@ public class UserResource extends EntityResource { @Context ContainerRequestContext containerRequestContext, @Valid CreateUser create) { User user = getUser(securityContext.getUserPrincipal().getName(), create); - if (Boolean.TRUE.equals(create.getIsBot())) { + if (Boolean.TRUE.equals(user.getIsBot())) { addAuthMechanismToBot(user, create, uriInfo); } // try { // Email Validation - validateEmailAlreadyExists(create.getEmail()); + validateEmailAlreadyExists(user.getEmail()); addUserAuthForBasic(user, create); } catch (RuntimeException ex) { return Response.status(CONFLICT) @@ -594,8 +594,7 @@ public class UserResource extends EntityResource { createdUserRes = create(uriInfo, securityContext, user); } catch (EntityNotFoundException ex) { if (isSelfSignUpEnabled) { - if (securityContext.getUserPrincipal().getName().equals(create.getName())) { - // User is creating himself on signup ?! :( + if (securityContext.getUserPrincipal().getName().equals(user.getName())) { User created = addHref(uriInfo, repository.create(uriInfo, user)); createdUserRes = Response.created(created.getHref()).entity(created).build(); } else {