aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2020-04-29 16:33:54 +0200
committersonartech <sonartech@sonarsource.com>2020-05-25 20:05:22 +0000
commit1cb0039c096e60727fdecb2547bb6873380dbce4 (patch)
tree66b71d88b84e6dc74e670d7819b2a8494b7b9bde /server/sonar-webserver-auth
parent0e6876dcb3d5a4137408f102c750d2beaee9dab7 (diff)
downloadsonarqube-1cb0039c096e60727fdecb2547bb6873380dbce4.tar.gz
sonarqube-1cb0039c096e60727fdecb2547bb6873380dbce4.zip
SONAR-13221 change PERM_TEMPLATES_USERS user_id FK to user_uuid
Diffstat (limited to 'server/sonar-webserver-auth')
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java14
2 files changed, 8 insertions, 8 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 2f953b354a5..39604174886 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
@@ -137,7 +137,7 @@ public class MemberUpdater {
String userUuid = user.getUuid();
String organizationUuid = organization.getUuid();
dbClient.userPermissionDao().deleteOrganizationMemberPermissions(dbSession, organizationUuid, userId);
- dbClient.permissionTemplateDao().deleteUserPermissionsByOrganization(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);
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 d23302b3885..e1a99f1022b 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
@@ -248,16 +248,16 @@ public class MemberUpdaterTest {
PermissionTemplateDto template = db.permissionTemplates().insertTemplate(organization);
PermissionTemplateDto anotherTemplate = db.permissionTemplates().insertTemplate(anotherOrganization);
String permission = "browse";
- db.permissionTemplates().addUserToTemplate(template.getUuid(), user.getId(), permission);
- db.permissionTemplates().addUserToTemplate(template.getUuid(), anotherUser.getId(), permission);
- db.permissionTemplates().addUserToTemplate(anotherTemplate.getUuid(), user.getId(), permission);
+ db.permissionTemplates().addUserToTemplate(template.getUuid(), user.getUuid(), permission);
+ db.permissionTemplates().addUserToTemplate(template.getUuid(), anotherUser.getUuid(), permission);
+ db.permissionTemplates().addUserToTemplate(anotherTemplate.getUuid(), user.getUuid(), permission);
underTest.removeMember(db.getSession(), organization, user);
- assertThat(dbClient.permissionTemplateDao().selectUserPermissionsByTemplateId(db.getSession(), template.getUuid())).extracting(PermissionTemplateUserDto::getUserId)
- .containsOnly(anotherUser.getId());
- assertThat(dbClient.permissionTemplateDao().selectUserPermissionsByTemplateId(db.getSession(), anotherTemplate.getUuid())).extracting(PermissionTemplateUserDto::getUserId)
- .containsOnly(user.getId());
+ assertThat(dbClient.permissionTemplateDao().selectUserPermissionsByTemplateId(db.getSession(), template.getUuid())).extracting(PermissionTemplateUserDto::getUserUuid)
+ .containsOnly(anotherUser.getUuid());
+ assertThat(dbClient.permissionTemplateDao().selectUserPermissionsByTemplateId(db.getSession(), anotherTemplate.getUuid())).extracting(PermissionTemplateUserDto::getUserUuid)
+ .containsOnly(user.getUuid());
}
@Test