From 7e33bb4d7f749cef65df800cacd5eef8bda9c702 Mon Sep 17 00:00:00 2001 From: Aurelien Poscia Date: Thu, 24 Aug 2023 11:12:23 +0200 Subject: [PATCH] SONAR-19783 Fix filter for (non-)managed groups --- .../src/it/java/org/sonar/db/user/ExternalGroupDaoIT.java | 4 ++-- .../src/main/java/org/sonar/db/user/ExternalGroupDao.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/user/ExternalGroupDaoIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/ExternalGroupDaoIT.java index a1a93e24fbd..9b78af7cfc4 100644 --- a/server/sonar-db-dao/src/it/java/org/sonar/db/user/ExternalGroupDaoIT.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/user/ExternalGroupDaoIT.java @@ -121,7 +121,7 @@ public class ExternalGroupDaoIT { String filterManagedUser = underTest.getManagedGroupSqlFilter(true); assertThat(filterManagedUser).isEqualTo( "(exists (select group_uuid from external_groups eg where eg.group_uuid = uuid) " - + "or exists (select group_uuid from github_orgs_groups gog eg where gog.group_uuid = uuid))"); + + "or exists (select group_uuid from github_orgs_groups gog where gog.group_uuid = uuid))"); } @Test @@ -129,7 +129,7 @@ public class ExternalGroupDaoIT { String filterNonManagedUser = underTest.getManagedGroupSqlFilter(false); assertThat(filterNonManagedUser).isEqualTo( "(not exists (select group_uuid from external_groups eg where eg.group_uuid = uuid) " - + "and not exists (select group_uuid from github_orgs_groups gog eg where gog.group_uuid = uuid))"); + + "and not exists (select group_uuid from github_orgs_groups gog where gog.group_uuid = uuid))"); } private List createAndInsertExternalGroupDtos(String provider, int numberOfGroups) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/ExternalGroupDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ExternalGroupDao.java index 4275912b1b5..8986dd2621f 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/ExternalGroupDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/ExternalGroupDao.java @@ -53,10 +53,10 @@ public class ExternalGroupDao implements Dao { public String getManagedGroupSqlFilter(boolean filterByManaged) { if (filterByManaged) { return "(exists (select group_uuid from external_groups eg where eg.group_uuid = uuid) " - + "or exists (select group_uuid from github_orgs_groups gog eg where gog.group_uuid = uuid))"; + + "or exists (select group_uuid from github_orgs_groups gog where gog.group_uuid = uuid))"; } return "(not exists (select group_uuid from external_groups eg where eg.group_uuid = uuid) " - + "and not exists (select group_uuid from github_orgs_groups gog eg where gog.group_uuid = uuid))"; + + "and not exists (select group_uuid from github_orgs_groups gog where gog.group_uuid = uuid))"; } public void deleteByExternalIdentityProvider(DbSession dbSession, String externalIdentityProvider) { -- 2.39.5