diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2020-04-30 13:05:38 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-05-25 20:05:22 +0000 |
commit | 7925b2f67b87f0d3d6086a3b006e276341f70566 (patch) | |
tree | a38811b48c5b62979aa848c5e04d01d15a023447 /server/sonar-webserver-auth | |
parent | 1cb0039c096e60727fdecb2547bb6873380dbce4 (diff) | |
download | sonarqube-7925b2f67b87f0d3d6086a3b006e276341f70566.tar.gz sonarqube-7925b2f67b87f0d3d6086a3b006e276341f70566.zip |
SONAR-13221 change PROPERTIES user_id FK to user_uuid
Diffstat (limited to 'server/sonar-webserver-auth')
2 files changed, 12 insertions, 11 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java index 39604174886..58da4ebdee1 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java @@ -139,8 +139,8 @@ public class MemberUpdater { dbClient.userPermissionDao().deleteOrganizationMemberPermissions(dbSession, organizationUuid, userId); dbClient.permissionTemplateDao().deleteUserPermissionsByOrganization(dbSession, organizationUuid, userUuid); dbClient.qProfileEditUsersDao().deleteByOrganizationAndUser(dbSession, organization, user); - dbClient.userGroupDao().deleteByOrganizationAndUser(dbSession, organizationUuid, user.getUuid()); - dbClient.propertiesDao().deleteByOrganizationAndUser(dbSession, organizationUuid, userId); + dbClient.userGroupDao().deleteByOrganizationAndUser(dbSession, organizationUuid, userUuid); + dbClient.propertiesDao().deleteByOrganizationAndUser(dbSession, organizationUuid, userUuid); dbClient.propertiesDao().deleteByOrganizationAndMatchingLogin(dbSession, organizationUuid, user.getLogin(), singletonList(DEFAULT_ISSUE_ASSIGNEE)); dbClient.organizationMemberDao().delete(dbSession, organizationUuid, userUuid); diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java index e1a99f1022b..f8d11d8bd49 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java @@ -337,17 +337,18 @@ public class MemberUpdaterTest { OrganizationDto anotherOrganization = db.organizations().insert(); ComponentDto anotherProject = db.components().insertPrivateProject(anotherOrganization); UserDto anotherUser = db.users().insertUser(); - insertProperty("KEY_11", "VALUE", project.uuid(), user.getId()); - insertProperty("KEY_12", "VALUE", project.uuid(), user.getId()); - insertProperty("KEY_11", "VALUE", project.uuid(), anotherUser.getId()); - insertProperty("KEY_11", "VALUE", anotherProject.uuid(), user.getId()); + insertProperty("KEY_11", "VALUE", project.uuid(), user.getUuid()); + insertProperty("KEY_12", "VALUE", project.uuid(), user.getUuid()); + insertProperty("KEY_11", "VALUE", project.uuid(), anotherUser.getUuid()); + insertProperty("KEY_11", "VALUE", anotherProject.uuid(), user.getUuid()); underTest.removeMember(db.getSession(), organization, user); assertThat(dbClient.propertiesDao().selectByQuery(PropertyQuery.builder().setComponentUuid(project.uuid()).build(), db.getSession())) - .hasSize(1).extracting(PropertyDto::getUserId).containsOnly(anotherUser.getId()); - assertThat(dbClient.propertiesDao().selectByQuery(PropertyQuery.builder().setComponentUuid(anotherProject.uuid()).build(), db.getSession())).extracting(PropertyDto::getUserId) - .hasSize(1).containsOnly(user.getId()); + .hasSize(1).extracting(PropertyDto::getUserUuid).containsOnly(anotherUser.getUuid()); + assertThat(dbClient.propertiesDao().selectByQuery(PropertyQuery.builder().setComponentUuid(anotherProject.uuid()).build(), db.getSession())) + .extracting(PropertyDto::getUserUuid) + .hasSize(1).containsOnly(user.getUuid()); } @Test @@ -506,10 +507,10 @@ public class MemberUpdaterTest { assertThat(dbClient.userPermissionDao().selectProjectPermissionsOfUser(db.getSession(), user.getId(), project.uuid())).containsOnly(permissions); } - private void insertProperty(String key, @Nullable String value, @Nullable String componentUuid, @Nullable Integer userId) { + private void insertProperty(String key, @Nullable String value, @Nullable String componentUuid, @Nullable String userUuid) { PropertyDto dto = new PropertyDto().setKey(key) .setComponentUuid(componentUuid) - .setUserId(userId) + .setUserUuid(userUuid) .setValue(value); db.properties().insertProperty(dto); } |