aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2021-01-05 12:19:25 -0600
committersonartech <sonartech@sonarsource.com>2021-01-11 20:20:39 +0000
commit6789a2ec09f916b67bb34400f332570d2ca26b94 (patch)
tree767909bb951844bafb67f4b99c0b7c18b560e670 /server/sonar-webserver-auth
parent16d235022a4711857cde9d0953be3a864b1bfb83 (diff)
downloadsonarqube-6789a2ec09f916b67bb34400f332570d2ca26b94.tar.gz
sonarqube-6789a2ec09f916b67bb34400f332570d2ca26b94.zip
SONAR-14245 Drop organization related tables
Diffstat (limited to 'server/sonar-webserver-auth')
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/DefaultOrganizationEnforcer.java43
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java104
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/package-info.java23
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java2
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdate.java2
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserSession.java13
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreator.java32
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreatorImpl.java57
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/DefaultOrganizationEnforcerTest.java46
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/permission/PermissionServiceImplTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/usergroups/DefaultGroupCreatorImplTest.java65
11 files changed, 7 insertions, 382 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/DefaultOrganizationEnforcer.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/DefaultOrganizationEnforcer.java
deleted file mode 100644
index 998b621583d..00000000000
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/DefaultOrganizationEnforcer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.organization;
-
-import org.picocontainer.Startable;
-
-//TODO remove together with the default organization concept
-@Deprecated
-public class DefaultOrganizationEnforcer implements Startable {
- private final DefaultOrganizationProvider defaultOrganizationProvider;
-
- public DefaultOrganizationEnforcer(DefaultOrganizationProvider defaultOrganizationProvider) {
- this.defaultOrganizationProvider = defaultOrganizationProvider;
- }
-
- @Override
- public void start() {
- // get will fail with IllegalStateException if no default organization can be found
- defaultOrganizationProvider.get();
- }
-
- @Override
- public void stop() {
- // nothing to do
- }
-}
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
deleted file mode 100644
index a2471a5fe40..00000000000
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.organization;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.user.UserDto;
-import org.sonar.db.user.UserGroupDto;
-import org.sonar.server.user.index.UserIndexer;
-import org.sonar.server.usergroups.DefaultGroupFinder;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.collect.Sets.difference;
-import static java.util.Collections.singletonList;
-import static java.util.stream.Collectors.toSet;
-import static org.sonar.api.CoreProperties.DEFAULT_ISSUE_ASSIGNEE;
-import static org.sonar.core.util.stream.MoreCollectors.toList;
-import static org.sonar.db.permission.GlobalPermission.ADMINISTER;
-
-public class MemberUpdater {
-
- private final DbClient dbClient;
- private final DefaultGroupFinder defaultGroupFinder;
- private final UserIndexer userIndexer;
-
- public MemberUpdater(DbClient dbClient, DefaultGroupFinder defaultGroupFinder, UserIndexer userIndexer) {
- this.dbClient = dbClient;
- this.defaultGroupFinder = defaultGroupFinder;
- this.userIndexer = userIndexer;
- }
-
- public void addMember(DbSession dbSession, UserDto user) {
- addMembers(dbSession, singletonList(user));
- }
-
- public void addMembers(DbSession dbSession, List<UserDto> users) {
- Set<String> currentMemberUuids = dbClient.userGroupDao().selectUserUuidsInGroup(dbSession, defaultGroupFinder.findDefaultGroup(dbSession).getUuid());
- List<UserDto> usersToAdd = users.stream()
- .filter(UserDto::isActive)
- .filter(u -> !currentMemberUuids.contains(u.getUuid()))
- .collect(toList());
- if (usersToAdd.isEmpty()) {
- return;
- }
- usersToAdd.forEach(u -> addMemberInDb(dbSession, u));
- userIndexer.commitAndIndex(dbSession, usersToAdd);
- }
-
- private void addMemberInDb(DbSession dbSession, UserDto user) {
- String defaultGroupUuid = defaultGroupFinder.findDefaultGroup(dbSession).getUuid();
- dbClient.userGroupDao().insert(dbSession,
- new UserGroupDto().setGroupUuid(defaultGroupUuid).setUserUuid(user.getUuid()));
- }
-
- public void removeMember(DbSession dbSession, UserDto user) {
- removeMembers(dbSession, singletonList(user));
- }
-
- public void removeMembers(DbSession dbSession, List<UserDto> users) {
- String defaultGroupUuid = defaultGroupFinder.findDefaultGroup(dbSession).getUuid();
- Set<String> currentMemberIds = dbClient.userGroupDao().selectUserUuidsInGroup(dbSession, defaultGroupUuid);
- List<UserDto> usersToRemove = users.stream()
- .filter(UserDto::isActive)
- .filter(u -> currentMemberIds.contains(u.getUuid()))
- .collect(toList());
- if (usersToRemove.isEmpty()) {
- return;
- }
-
- Set<String> userUuidsToRemove = usersToRemove.stream().map(UserDto::getUuid).collect(toSet());
- Set<String> adminUuids = new HashSet<>(dbClient.authorizationDao().selectUserUuidsWithGlobalPermission(dbSession, ADMINISTER.getKey()));
- checkArgument(!difference(adminUuids, userUuidsToRemove).isEmpty(), "The last administrator member cannot be removed");
-
- usersToRemove.forEach(u -> removeMemberInDb(dbSession, u));
- userIndexer.commitAndIndex(dbSession, usersToRemove);
- }
-
- private void removeMemberInDb(DbSession dbSession, UserDto user) {
- String userUuid = user.getUuid();
- dbClient.propertiesDao().deleteByUser(dbSession, userUuid);
- dbClient.propertiesDao().deleteByMatchingLogin(dbSession, user.getLogin(), singletonList(DEFAULT_ISSUE_ASSIGNEE));
- }
-
-}
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/package-info.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/package-info.java
deleted file mode 100644
index e3c9b9a42ad..00000000000
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.server.organization;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java
index 06fa480430e..e1aaaed9aad 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java
@@ -52,7 +52,7 @@ public class PermissionServiceImpl implements PermissionService {
}
/**
- * Return an immutable Set of all organization permissions
+ * Return an immutable Set of all permissions
*/
@Override
public List<GlobalPermission> getGlobalPermissions() {
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdate.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdate.java
index 9ddfbe254da..028bb4da5fb 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdate.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdate.java
@@ -25,7 +25,7 @@ import org.sonar.db.qualityprofile.RulesProfileDto;
public interface BuiltInQProfileUpdate {
/**
- * Persist an existing built-in profile and associate it to all existing organizations.
+ * Persist an existing built-in profile.
* Db session is committed and Elasticsearch indices are updated.
*/
List<ActiveRuleChange> update(DbSession dbSession, BuiltInQProfile builtInQProfile, RulesProfileDto ruleProfile);
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserSession.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserSession.java
index 0a17948610c..285c1f21f97 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserSession.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserSession.java
@@ -148,7 +148,7 @@ public interface UserSession {
/**
* Whether the user has root privileges. If {@code true}, then user automatically
- * benefits from all the permissions on all organizations and projects.
+ * benefits from all the permissions on all projects.
*/
boolean isRoot();
@@ -164,12 +164,9 @@ public interface UserSession {
UserSession checkLoggedIn();
/**
- * Returns {@code true} if the permission is granted on the organization, otherwise {@code false}.
+ * Returns {@code true} if the permission is granted, otherwise {@code false}.
*
- * If the organization does not exist, then returns {@code false}.
- *
- * Always returns {@code true} if {@link #isRoot()} is {@code true}, even if
- * organization does not exist.
+ * Always returns {@code true} if {@link #isRoot()} is {@code true}.
*/
boolean hasPermission(GlobalPermission permission);
@@ -188,8 +185,6 @@ public interface UserSession {
* Always returns {@code true} if {@link #isRoot()} is {@code true}, even if
* component does not exist.
*
- * If the permission is not granted, then the organization permission is _not_ checked.
- *
* @param component non-null component.
* @param permission project permission as defined by {@link org.sonar.server.permission.PermissionService}
*/
@@ -246,7 +241,7 @@ public interface UserSession {
* Returns {@code true} if:
* <ul>
* <li>{@link #isRoot()} is {@code true}</li>
- * <li>organization feature is disabled and user is administrator of the (single) default organization</li>
+ * <li>user is administrator</li>
* </ul>
*/
boolean isSystemAdministrator();
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreator.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreator.java
deleted file mode 100644
index 91e4011ad44..00000000000
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.usergroups;
-
-import org.sonar.db.DbSession;
-import org.sonar.db.user.GroupDto;
-
-public interface DefaultGroupCreator {
-
- /**
- * Create the default group
- */
- GroupDto create(DbSession dbSession);
-
-}
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreatorImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreatorImpl.java
deleted file mode 100644
index 59de2b6a2c4..00000000000
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/usergroups/DefaultGroupCreatorImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.usergroups;
-
-import java.util.Optional;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.user.GroupDto;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-public class DefaultGroupCreatorImpl implements DefaultGroupCreator {
-
- public static final String DEFAULT_GROUP_NAME = "Members";
- private final DbClient dbClient;
- private final UuidFactory uuidFactory;
- private final DefaultOrganizationProvider organizationProvider;
-
- public DefaultGroupCreatorImpl(DbClient dbClient, UuidFactory uuidFactory, DefaultOrganizationProvider organizationProvider) {
- this.dbClient = dbClient;
- this.uuidFactory = uuidFactory;
- this.organizationProvider = organizationProvider;
- }
-
- public GroupDto create(DbSession dbSession) {
- Optional<GroupDto> existingMembersGroup = dbClient.groupDao().selectByName(dbSession, DEFAULT_GROUP_NAME);
- checkArgument(!existingMembersGroup.isPresent(), "The group '%s' already exists", DEFAULT_GROUP_NAME);
-
- GroupDto defaultGroup = new GroupDto()
- .setUuid(uuidFactory.create())
- .setName(DEFAULT_GROUP_NAME)
- .setDescription("All members of the organization");
- dbClient.groupDao().insert(dbSession, defaultGroup);
- dbClient.organizationDao().setDefaultGroupUuid(dbSession, organizationProvider.get().getUuid(), defaultGroup);
- return defaultGroup;
- }
-
-}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/DefaultOrganizationEnforcerTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/DefaultOrganizationEnforcerTest.java
deleted file mode 100644
index d778b44d7ff..00000000000
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/DefaultOrganizationEnforcerTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.organization;
-
-import org.junit.Test;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-public class DefaultOrganizationEnforcerTest {
- private DefaultOrganizationProvider defaultOrganizationProvider = mock(DefaultOrganizationProvider.class);
- private DefaultOrganizationEnforcer underTest = new DefaultOrganizationEnforcer(defaultOrganizationProvider);
-
- @Test
- public void start_calls_provider_get_method() {
- underTest.start();
-
- verify(defaultOrganizationProvider).get();
- verifyNoMoreInteractions(defaultOrganizationProvider);
- }
-
- @Test
- public void stop_does_nothing() {
- underTest.stop();
-
- verifyNoMoreInteractions(defaultOrganizationProvider);
- }
-}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/permission/PermissionServiceImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/permission/PermissionServiceImplTest.java
index ace18a1c169..3e4c97c6e17 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/permission/PermissionServiceImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/permission/PermissionServiceImplTest.java
@@ -31,7 +31,7 @@ public class PermissionServiceImplTest {
private PermissionServiceImpl underTest = new PermissionServiceImpl(resourceTypesRule);
@Test
- public void organizationPermissions_must_be_ordered() {
+ public void globalPermissions_must_be_ordered() {
assertThat(underTest.getGlobalPermissions())
.extracting(GlobalPermission::getKey)
.containsExactly("admin", "gateadmin", "profileadmin", "provisioning", "scan", "applicationcreator", "portfoliocreator");
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/usergroups/DefaultGroupCreatorImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/usergroups/DefaultGroupCreatorImplTest.java
deleted file mode 100644
index 32c7df90f6b..00000000000
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/usergroups/DefaultGroupCreatorImplTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2021 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.usergroups;
-
-import java.util.Optional;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.core.util.SequenceUuidFactory;
-import org.sonar.db.DbTester;
-import org.sonar.db.user.GroupDto;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DefaultGroupCreatorImplTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Rule
- public DbTester db = DbTester.create();
-
- private final DefaultGroupCreator underTest = new DefaultGroupCreatorImpl(db.getDbClient(), new SequenceUuidFactory(), TestDefaultOrganizationProvider.from(db));
-
- @Test
- public void create_default_group() {
- underTest.create(db.getSession());
-
- Optional<String> defaultGroupUuid = db.getDbClient().organizationDao().getDefaultGroupUuid(db.getSession(), db.getDefaultOrganization().getUuid());
- assertThat(defaultGroupUuid).isPresent();
- assertThat(db.getDbClient().groupDao().selectByUuid(db.getSession(), defaultGroupUuid.get()))
- .extracting(GroupDto::getName, GroupDto::getDescription)
- .containsOnly("Members", "All members of the organization");
- }
-
- @Test
- public void fail_with_IAE_when_default_group_already_exist() {
- db.permissionTemplates().insertTemplate();
- db.users().insertGroup("Members");
-
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage(String.format("The group '%s' already exists", "Members"));
-
- underTest.create(db.getSession());
- }
-
-}