diff options
author | Wojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com> | 2023-11-21 11:59:19 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-11-23 20:02:57 +0000 |
commit | 6918599a8059b3c561ada4f26817b559c12e687e (patch) | |
tree | 47e0d9133b38392a7ec63080ee28ae6872edf874 | |
parent | 7e76009e29913a70911aab85031ed79759c2d45a (diff) | |
download | sonarqube-6918599a8059b3c561ada4f26817b559c12e687e.tar.gz sonarqube-6918599a8059b3c561ada4f26817b559c12e687e.zip |
SONAR-21058 API v2 GET /authorizations/groups/{groupId}
20 files changed, 347 insertions, 4 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/GroupService.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/group/service/GroupService.java index 1dc200fc933..4e28d96fcfd 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/GroupService.java +++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/group/service/GroupService.java @@ -17,7 +17,7 @@ * 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.ws; +package org.sonar.server.common.group.service; import java.util.Optional; import javax.annotation.Nullable; @@ -49,6 +49,10 @@ public class GroupService { return dbClient.groupDao().selectByName(dbSession, groupName); } + public Optional<GroupDto> findGroupByUuid(DbSession dbSession, String groupUuid) { + return Optional.ofNullable(dbClient.groupDao().selectByUuid(dbSession, groupUuid)); + } + public void delete(DbSession dbSession, GroupDto group) { checkGroupIsNotDefault(dbSession, group); checkNotTryingToDeleteLastAdminGroup(dbSession, group); diff --git a/server/sonar-webserver-common/src/main/java/org/sonar/server/common/group/service/package-info.java b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/group/service/package-info.java new file mode 100644 index 00000000000..3e126243ab7 --- /dev/null +++ b/server/sonar-webserver-common/src/main/java/org/sonar/server/common/group/service/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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.common.group.service; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/GroupServiceTest.java b/server/sonar-webserver-common/src/test/java/org/sonar/server/common/group/service/GroupServiceTest.java index 998a5095015..f64f4e1c200 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/GroupServiceTest.java +++ b/server/sonar-webserver-common/src/test/java/org/sonar/server/common/group/service/GroupServiceTest.java @@ -17,7 +17,7 @@ * 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.ws; +package org.sonar.server.common.group.service; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; @@ -100,7 +100,7 @@ public class GroupServiceTest { } @Test - public void findGroupDtoOrThrow_whenGroupExists_returnsIt() { + public void findGroup_whenGroupExists_returnsIt() { GroupDto groupDto = mockGroupDto(); when(dbClient.groupDao().selectByName(dbSession, GROUP_NAME)) @@ -110,7 +110,7 @@ public class GroupServiceTest { } @Test - public void findGroupDtoOrThrow_whenGroupDoesntExist_throw() { + public void findGroup_whenGroupDoesntExist_returnsEmtpyOptional() { when(dbClient.groupDao().selectByName(dbSession, GROUP_NAME)) .thenReturn(Optional.empty()); @@ -118,6 +118,24 @@ public class GroupServiceTest { } @Test + public void findGroupByUuid_whenGroupExists_returnsIt() { + GroupDto groupDto = mockGroupDto(); + + when(dbClient.groupDao().selectByUuid(dbSession, GROUP_UUID)) + .thenReturn(groupDto); + + assertThat(groupService.findGroupByUuid(dbSession, GROUP_UUID)).contains(groupDto); + } + + @Test + public void findGroupByUuid_whenGroupDoesntExist_returnsEmptyOptional() { + when(dbClient.groupDao().selectByUuid(dbSession, GROUP_UUID)) + .thenReturn(null); + + assertThat(groupService.findGroupByUuid(dbSession, GROUP_UUID)).isEmpty(); + } + + @Test public void delete_whenNotDefaultAndNotLastAdminGroup_deleteGroup() { GroupDto groupDto = mockGroupDto(); diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java index 9e5c9aa684d..7c99e450da1 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java @@ -27,6 +27,9 @@ public class WebApiEndpoints { public static final String USERS_MANAGEMENT_DOMAIN = "/users-management"; public static final String USER_ENDPOINT = USERS_MANAGEMENT_DOMAIN + "/users"; public static final String JSON_MERGE_PATCH_CONTENT_TYPE = "application/merge-patch+json"; + public static final String AUTHORIZATIONS_DOMAIN = "/authorizations"; + + public static final String GROUPS_ENDPOINT = AUTHORIZATIONS_DOMAIN + "/groups"; private WebApiEndpoints() { } diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/DefaultGroupController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/DefaultGroupController.java new file mode 100644 index 00000000000..49a4e4f2f89 --- /dev/null +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/DefaultGroupController.java @@ -0,0 +1,56 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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.v2.api.group.controller; + +import org.sonar.db.DbClient; +import org.sonar.db.DbSession; +import org.sonar.db.user.GroupDto; +import org.sonar.server.common.group.service.GroupService; +import org.sonar.server.exceptions.NotFoundException; +import org.sonar.server.user.UserSession; +import org.sonar.server.v2.api.group.response.RestGroupResponse; + +public class DefaultGroupController implements GroupController { + + private static final String GROUP_NOT_FOUND_MESSAGE = "Group '%s' not found"; + private final GroupService groupService; + private final DbClient dbClient; + private final UserSession userSession; + + public DefaultGroupController(GroupService groupService, DbClient dbClient, UserSession userSession) { + this.groupService = groupService; + this.dbClient = dbClient; + this.userSession = userSession; + } + + @Override + public RestGroupResponse fetchGroup(String id) { + userSession.checkLoggedIn().checkIsSystemAdministrator(); + try (DbSession session = dbClient.openSession(false)) { + return groupService.findGroupByUuid(session, id) + .map(DefaultGroupController::groupDtoToResponse) + .orElseThrow(() -> new NotFoundException(String.format(GROUP_NOT_FOUND_MESSAGE, id))); + } + } + + private static RestGroupResponse groupDtoToResponse(GroupDto group) { + return new RestGroupResponse(group.getUuid(), group.getName(), group.getDescription()); + } +} diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/GroupController.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/GroupController.java new file mode 100644 index 00000000000..f889fc8b686 --- /dev/null +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/GroupController.java @@ -0,0 +1,43 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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.v2.api.group.controller; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import org.sonar.server.v2.api.group.response.RestGroupResponse; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +import static org.sonar.server.v2.WebApiEndpoints.GROUPS_ENDPOINT; + +@RequestMapping(GROUPS_ENDPOINT) +@RestController +public interface GroupController { + + @GetMapping(path = "/{id}") + @ResponseStatus(HttpStatus.OK) + @Operation(summary = "Fetch a single group", description = "Fetch a single group.") + RestGroupResponse fetchGroup(@PathVariable("id") @Parameter(description = "The id of the group to fetch.", required = true, in = ParameterIn.PATH) String id); +} diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/package-info.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/package-info.java new file mode 100644 index 00000000000..44abc95d13d --- /dev/null +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/controller/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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.v2.api.group.controller; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/response/RestGroupResponse.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/response/RestGroupResponse.java new file mode 100644 index 00000000000..6a4bdd30c83 --- /dev/null +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/response/RestGroupResponse.java @@ -0,0 +1,31 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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.v2.api.group.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import javax.annotation.Nullable; + +public record RestGroupResponse( + @Schema(accessMode = Schema.AccessMode.READ_ONLY) + String id, + String name, + @Nullable + String description) { +} diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/response/package-info.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/response/package-info.java new file mode 100644 index 00000000000..e70cba3847b --- /dev/null +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/group/response/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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.v2.api.group.response; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/PlatformLevel4WebConfig.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/PlatformLevel4WebConfig.java index 9231cc10c6b..fa61ea447cc 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/PlatformLevel4WebConfig.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/PlatformLevel4WebConfig.java @@ -20,6 +20,8 @@ package org.sonar.server.v2.config; import javax.annotation.Nullable; +import org.sonar.db.DbClient; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.common.health.CeStatusNodeCheck; import org.sonar.server.common.health.DbConnectionNodeCheck; import org.sonar.server.common.health.EsStatusNodeCheck; @@ -31,6 +33,8 @@ import org.sonar.server.health.HealthChecker; import org.sonar.server.platform.NodeInformation; import org.sonar.server.user.SystemPasscode; import org.sonar.server.user.UserSession; +import org.sonar.server.v2.api.group.controller.DefaultGroupController; +import org.sonar.server.v2.api.group.controller.GroupController; import org.sonar.server.v2.api.system.controller.DefaultLivenessController; import org.sonar.server.v2.api.system.controller.HealthController; import org.sonar.server.v2.api.system.controller.LivenessController; @@ -75,4 +79,9 @@ public class PlatformLevel4WebConfig { return new DefaultUserController(userSession, userService, usersSearchResponseGenerator); } + @Bean + public GroupController groupController(GroupService groupService, DbClient dbClient, UserSession userSession) { + return new DefaultGroupController(groupService, dbClient, userSession); + } + } diff --git a/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/api/group/controller/DefaultGroupControllerTest.java b/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/api/group/controller/DefaultGroupControllerTest.java new file mode 100644 index 00000000000..387b6daa8e4 --- /dev/null +++ b/server/sonar-webserver-webapi-v2/src/test/java/org/sonar/server/v2/api/group/controller/DefaultGroupControllerTest.java @@ -0,0 +1,101 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 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.v2.api.group.controller; + +import java.util.Optional; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.db.DbClient; +import org.sonar.db.DbSession; +import org.sonar.db.user.GroupDto; +import org.sonar.server.common.group.service.GroupService; +import org.sonar.server.tester.UserSessionRule; +import org.sonar.server.v2.api.ControllerTester; +import org.springframework.test.web.servlet.MockMvc; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.sonar.server.v2.WebApiEndpoints.GROUPS_ENDPOINT; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +public class DefaultGroupControllerTest { + + private static final String GROUP_UUID = "1234"; + @Rule + public UserSessionRule userSession = UserSessionRule.standalone(); + + private final GroupService groupService = mock(GroupService.class); + private final DbClient dbClient = mock(DbClient.class); + + private final DbSession dbSession = mock(DbSession.class); + + private final MockMvc mockMvc = ControllerTester.getMockMvc(new DefaultGroupController(groupService, dbClient, userSession)); + + @Before + public void setUp() { + when(dbClient.openSession(false)).thenReturn(dbSession); + } + + @Test + public void fetchGroup_whenGroupExists_returnsTheGroup() throws Exception { + + GroupDto groupDto = new GroupDto().setUuid(GROUP_UUID).setName("name").setDescription("description"); + + when(groupService.findGroupByUuid(dbSession, GROUP_UUID)).thenReturn(Optional.of(groupDto)); + + userSession.logIn().setSystemAdministrator(); + mockMvc.perform(get(GROUPS_ENDPOINT + "/" + GROUP_UUID)) + .andExpectAll( + status().isOk(), + content().json(""" + { + "id": "1234", + "name": "name", + "description": "description" + } + """)); + } + + @Test + public void fetchGroup_whenCallerIsNotAdmin_shouldReturnForbidden() throws Exception { + userSession.logIn().setNonSystemAdministrator(); + mockMvc.perform( + get(GROUPS_ENDPOINT + "/" + GROUP_UUID)) + .andExpectAll( + status().isForbidden(), + content().json("{\"message\":\"Insufficient privileges\"}")); + } + + @Test + public void fetchGroup_whenGroupDoesntExist_shouldReturnNotFound() throws Exception { + userSession.logIn().setSystemAdministrator(); + when(groupService.findGroupByUuid(dbSession, GROUP_UUID)).thenReturn(Optional.empty()); + mockMvc.perform( + get(GROUPS_ENDPOINT + "/" + GROUP_UUID) + .content("{}")) + .andExpectAll( + status().isNotFound(), + content().json("{\"message\":\"Group '1234' not found\"}")); + } + +} diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java index 3541a23cfb0..225e2478031 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java @@ -28,6 +28,7 @@ import org.sonar.api.utils.System2; import org.sonar.core.util.SequenceUuidFactory; import org.sonar.db.DbTester; import org.sonar.db.user.GroupDto; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.ServerException; diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java index cba6d341edb..f8d2e2eee36 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java @@ -37,6 +37,7 @@ import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.db.qualityprofile.QProfileDto; import org.sonar.db.user.GroupDto; import org.sonar.db.user.UserDto; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.management.ManagedInstanceService; diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/ExternalGroupServiceIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/ExternalGroupServiceIT.java index a355dbfd164..b9666421dbf 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/ExternalGroupServiceIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/ExternalGroupServiceIT.java @@ -29,6 +29,7 @@ import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.user.ExternalGroupDto; import org.sonar.db.user.GroupDto; +import org.sonar.server.common.group.service.GroupService; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UpdateActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UpdateActionIT.java index 787af00f823..f82cbaee955 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UpdateActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UpdateActionIT.java @@ -28,6 +28,7 @@ import org.sonar.core.util.UuidFactoryImpl; import org.sonar.db.DbTester; import org.sonar.db.user.GroupDto; import org.sonar.db.user.UserDto; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java index a728d4704a9..c6d367e4976 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java @@ -27,6 +27,7 @@ import org.sonar.api.server.ws.WebService.NewController; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.GroupDto; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.common.management.ManagedInstanceChecker; import org.sonar.server.user.UserSession; import org.sonarqube.ws.UserGroups; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java index bc16c54cca6..f0f67ac5fe9 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java @@ -29,6 +29,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.permission.GlobalPermission; import org.sonar.db.user.GroupDto; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.management.ManagedInstanceService; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/ExternalGroupService.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/ExternalGroupService.java index dc5befd6bb2..989615b13dc 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/ExternalGroupService.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/ExternalGroupService.java @@ -26,6 +26,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.ExternalGroupDto; import org.sonar.db.user.GroupDto; +import org.sonar.server.common.group.service.GroupService; public class ExternalGroupService { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java index 8113fa13afd..7310c11302b 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java @@ -28,6 +28,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.GroupDto; import org.sonar.db.user.UserMembershipQuery; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.common.management.ManagedInstanceChecker; import org.sonar.server.user.UserSession; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UserGroupsModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UserGroupsModule.java index 22ea5abe0bf..9f92f4881cd 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UserGroupsModule.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UserGroupsModule.java @@ -20,6 +20,7 @@ package org.sonar.server.usergroups.ws; import org.sonar.core.platform.Module; +import org.sonar.server.common.group.service.GroupService; import org.sonar.server.common.management.ManagedInstanceChecker; public class UserGroupsModule extends Module { |