Search in sources :

Example 1 with PROVISION_PROJECTS

use of org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS in project sonarqube by SonarSource.

the class SearchGitlabReposAction method doHandle.

private AlmIntegrations.SearchGitlabReposWsResponse doHandle(Request request) {
    String almSettingKey = request.mandatoryParam(PARAM_ALM_SETTING);
    String projectName = request.param(PARAM_PROJECT_NAME);
    int pageNumber = request.mandatoryParamAsInt("p");
    int pageSize = request.mandatoryParamAsInt("ps");
    try (DbSession dbSession = dbClient.openSession(false)) {
        userSession.checkLoggedIn().checkPermission(PROVISION_PROJECTS);
        String userUuid = requireNonNull(userSession.getUuid(), "User UUID cannot be null");
        AlmSettingDto almSettingDto = dbClient.almSettingDao().selectByKey(dbSession, almSettingKey).orElseThrow(() -> new NotFoundException(String.format("ALM Setting '%s' not found", almSettingKey)));
        Optional<AlmPatDto> almPatDto = dbClient.almPatDao().selectByUserAndAlmSetting(dbSession, userUuid, almSettingDto);
        String personalAccessToken = almPatDto.map(AlmPatDto::getPersonalAccessToken).orElseThrow(() -> new IllegalArgumentException("No personal access token found"));
        String gitlabUrl = requireNonNull(almSettingDto.getUrl(), "ALM url cannot be null");
        ProjectList gitlabProjectList = gitlabHttpClient.searchProjects(gitlabUrl, personalAccessToken, projectName, pageNumber, pageSize);
        Map<String, ProjectKeyName> sqProjectsKeyByGitlabProjectId = getSqProjectsKeyByGitlabProjectId(dbSession, almSettingDto, gitlabProjectList);
        List<GitlabRepository> gitlabRepositories = gitlabProjectList.getProjects().stream().map(project -> toGitlabRepository(project, sqProjectsKeyByGitlabProjectId)).collect(toList());
        Paging.Builder pagingBuilder = Paging.newBuilder().setPageIndex(gitlabProjectList.getPageNumber()).setPageSize(gitlabProjectList.getPageSize());
        Integer gitlabProjectListTotal = gitlabProjectList.getTotal();
        if (gitlabProjectListTotal != null) {
            pagingBuilder.setTotal(gitlabProjectListTotal);
        }
        return AlmIntegrations.SearchGitlabReposWsResponse.newBuilder().addAllRepositories(gitlabRepositories).setPaging(pagingBuilder.build()).build();
    }
}
Also used : AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) ProjectList(org.sonar.alm.client.gitlab.ProjectList) PROVISION_PROJECTS(org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS) AlmIntegrations(org.sonarqube.ws.AlmIntegrations) GitlabRepository(org.sonarqube.ws.AlmIntegrations.GitlabRepository) Function(java.util.function.Function) DbSession(org.sonar.db.DbSession) Request(org.sonar.api.server.ws.Request) WebService(org.sonar.api.server.ws.WebService) ProjectAlmSettingDto(org.sonar.db.alm.setting.ProjectAlmSettingDto) Map(java.util.Map) GitlabHttpClient(org.sonar.alm.client.gitlab.GitlabHttpClient) Objects.requireNonNull(java.util.Objects.requireNonNull) Response(org.sonar.api.server.ws.Response) AlmPatDto(org.sonar.db.alm.pat.AlmPatDto) Collectors.toSet(java.util.stream.Collectors.toSet) Project(org.sonar.alm.client.gitlab.Project) Set(java.util.Set) Paging(org.sonarqube.ws.Common.Paging) Collectors(java.util.stream.Collectors) BinaryOperator(java.util.function.BinaryOperator) NotFoundException(org.sonar.server.exceptions.NotFoundException) DbClient(org.sonar.db.DbClient) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Optional(java.util.Optional) AlmIntegrationsWsAction(org.sonar.server.almintegration.ws.AlmIntegrationsWsAction) UserSession(org.sonar.server.user.UserSession) WsUtils.writeProtobuf(org.sonar.server.ws.WsUtils.writeProtobuf) Paging(org.sonarqube.ws.Common.Paging) AlmPatDto(org.sonar.db.alm.pat.AlmPatDto) NotFoundException(org.sonar.server.exceptions.NotFoundException) GitlabRepository(org.sonarqube.ws.AlmIntegrations.GitlabRepository) DbSession(org.sonar.db.DbSession) ProjectList(org.sonar.alm.client.gitlab.ProjectList) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) ProjectAlmSettingDto(org.sonar.db.alm.setting.ProjectAlmSettingDto)

Example 2 with PROVISION_PROJECTS

use of org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS in project sonarqube by SonarSource.

the class SearchBitbucketCloudReposAction method doHandle.

private SearchBitbucketcloudReposWsResponse doHandle(Request request) {
    userSession.checkLoggedIn().checkPermission(PROVISION_PROJECTS);
    String almSettingKey = request.mandatoryParam(PARAM_ALM_SETTING);
    String repoName = request.param(PARAM_REPO_NAME);
    int page = request.mandatoryParamAsInt(PAGE);
    int pageSize = request.mandatoryParamAsInt(PAGE_SIZE);
    try (DbSession dbSession = dbClient.openSession(false)) {
        AlmSettingDto almSettingDto = dbClient.almSettingDao().selectByKey(dbSession, almSettingKey).orElseThrow(() -> new NotFoundException(String.format("ALM Setting '%s' not found", almSettingKey)));
        String workspace = ofNullable(almSettingDto.getAppId()).orElseThrow(() -> new IllegalArgumentException(String.format("workspace for alm setting %s is missing", almSettingDto.getKey())));
        String userUuid = requireNonNull(userSession.getUuid(), "User UUID cannot be null");
        Optional<AlmPatDto> almPatDto = dbClient.almPatDao().selectByUserAndAlmSetting(dbSession, userUuid, almSettingDto);
        String pat = almPatDto.map(AlmPatDto::getPersonalAccessToken).orElseThrow(() -> new IllegalArgumentException("No personal access token found"));
        RepositoryList repositoryList = bitbucketCloudRestClient.searchRepos(pat, workspace, repoName, page, pageSize);
        Map<String, String> sqProjectKeyByRepoSlug = getSqProjectKeyByRepoSlug(dbSession, almSettingDto, repositoryList.getValues());
        List<BBCRepo> bbcRepos = repositoryList.getValues().stream().map(repository -> toBBCRepo(repository, workspace, sqProjectKeyByRepoSlug)).collect(toList());
        SearchBitbucketcloudReposWsResponse.Builder builder = SearchBitbucketcloudReposWsResponse.newBuilder().setIsLastPage(repositoryList.getNext() == null).setPaging(Paging.newBuilder().setPageIndex(page).setPageSize(pageSize).build()).addAllRepositories(bbcRepos);
        return builder.build();
    }
}
Also used : AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) BBCRepo(org.sonarqube.ws.AlmIntegrations.BBCRepo) PROVISION_PROJECTS(org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS) Repository(org.sonar.alm.client.bitbucket.bitbucketcloud.Repository) DbSession(org.sonar.db.DbSession) SearchBitbucketcloudReposWsResponse(org.sonarqube.ws.AlmIntegrations.SearchBitbucketcloudReposWsResponse) PAGE(org.sonar.api.server.ws.WebService.Param.PAGE) Request(org.sonar.api.server.ws.Request) WebService(org.sonar.api.server.ws.WebService) ProjectAlmSettingDto(org.sonar.db.alm.setting.ProjectAlmSettingDto) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) Objects.requireNonNull(java.util.Objects.requireNonNull) Response(org.sonar.api.server.ws.Response) AlmPatDto(org.sonar.db.alm.pat.AlmPatDto) Collectors.toSet(java.util.stream.Collectors.toSet) Optional.ofNullable(java.util.Optional.ofNullable) BitbucketCloudRestClient(org.sonar.alm.client.bitbucket.bitbucketcloud.BitbucketCloudRestClient) Set(java.util.Set) Paging(org.sonarqube.ws.Common.Paging) RepositoryList(org.sonar.alm.client.bitbucket.bitbucketcloud.RepositoryList) BinaryOperator(java.util.function.BinaryOperator) NotFoundException(org.sonar.server.exceptions.NotFoundException) DbClient(org.sonar.db.DbClient) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ProjectDto(org.sonar.db.project.ProjectDto) Optional(java.util.Optional) PAGE_SIZE(org.sonar.api.server.ws.WebService.Param.PAGE_SIZE) AlmIntegrationsWsAction(org.sonar.server.almintegration.ws.AlmIntegrationsWsAction) UserSession(org.sonar.server.user.UserSession) WsUtils.writeProtobuf(org.sonar.server.ws.WsUtils.writeProtobuf) BBCRepo(org.sonarqube.ws.AlmIntegrations.BBCRepo) AlmPatDto(org.sonar.db.alm.pat.AlmPatDto) NotFoundException(org.sonar.server.exceptions.NotFoundException) DbSession(org.sonar.db.DbSession) SearchBitbucketcloudReposWsResponse(org.sonarqube.ws.AlmIntegrations.SearchBitbucketcloudReposWsResponse) RepositoryList(org.sonar.alm.client.bitbucket.bitbucketcloud.RepositoryList) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) ProjectAlmSettingDto(org.sonar.db.alm.setting.ProjectAlmSettingDto)

Example 3 with PROVISION_PROJECTS

use of org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS in project sonarqube by SonarSource.

the class BranchReportSubmitterTest method submit_report_on_missing_branch_of_missing_project_provisions_project_when_PROVISION_PROJECT_perm.

@Test
public void submit_report_on_missing_branch_of_missing_project_provisions_project_when_PROVISION_PROJECT_perm() {
    ComponentDto nonExistingProject = newPrivateProjectDto();
    UserDto user = db.users().insertUser();
    userSession.logIn(user).addPermission(PROVISION_PROJECTS).addPermission(SCAN);
    Map<String, String> randomCharacteristics = randomNonEmptyMap();
    ComponentDto createdBranch = createButDoNotInsertBranch(nonExistingProject);
    BranchSupport.ComponentKey componentKey = createComponentKeyOfBranch(createdBranch);
    when(branchSupportDelegate.createComponentKey(nonExistingProject.getDbKey(), randomCharacteristics)).thenReturn(componentKey);
    when(componentUpdater.createWithoutCommit(any(), any(), eq(user.getUuid()), eq(user.getLogin()), any())).thenAnswer((Answer<ComponentDto>) invocation -> db.components().insertPrivateProject(nonExistingProject));
    when(branchSupportDelegate.createBranchComponent(any(DbSession.class), same(componentKey), eq(nonExistingProject), any())).thenReturn(createdBranch);
    when(permissionTemplateService.wouldUserHaveScanPermissionWithDefaultTemplate(any(DbSession.class), any(), eq(nonExistingProject.getKey()))).thenReturn(true);
    String taskUuid = mockSuccessfulPrepareSubmitCall();
    InputStream reportInput = IOUtils.toInputStream("{binary}", StandardCharsets.UTF_8);
    underTest.submit(nonExistingProject.getDbKey(), nonExistingProject.name(), randomCharacteristics, reportInput);
    BranchDto exitingProjectMainBranch = db.getDbClient().branchDao().selectByUuid(db.getSession(), nonExistingProject.uuid()).get();
    verify(branchSupport).createBranchComponent(any(DbSession.class), same(componentKey), eq(nonExistingProject), eq(exitingProjectMainBranch));
    verify(branchSupportDelegate).createComponentKey(nonExistingProject.getDbKey(), randomCharacteristics);
    verify(branchSupportDelegate).createBranchComponent(any(DbSession.class), same(componentKey), eq(nonExistingProject), eq(exitingProjectMainBranch));
    verifyNoMoreInteractions(branchSupportDelegate);
    verifyQueueSubmit(nonExistingProject, createdBranch, user, randomCharacteristics, taskUuid);
    verify(componentUpdater).commitAndIndex(any(DbSession.class), eq(nonExistingProject));
}
Also used : CeTaskTypes(org.sonar.db.ce.CeTaskTypes) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Random(java.util.Random) DataProviderRunner(com.tngtech.java.junit.dataprovider.DataProviderRunner) DbSession(org.sonar.db.DbSession) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) SCAN(org.sonar.db.permission.GlobalPermission.SCAN) Mockito.verifyNoMoreInteractions(org.mockito.Mockito.verifyNoMoreInteractions) Map(java.util.Map) Visibility(org.sonar.server.project.Visibility) ComponentTesting(org.sonar.db.component.ComponentTesting) Assert.fail(org.junit.Assert.fail) DbTester(org.sonar.db.DbTester) ImmutableMap(com.google.common.collect.ImmutableMap) System2(org.sonar.api.utils.System2) StandardCharsets(java.nio.charset.StandardCharsets) PermissionTemplateService(org.sonar.server.permission.PermissionTemplateService) IOUtils(org.apache.commons.io.IOUtils) ComponentDto(org.sonar.db.component.ComponentDto) ForbiddenException(org.sonar.server.exceptions.ForbiddenException) MoreCollectors.uniqueIndex(org.sonar.core.util.stream.MoreCollectors.uniqueIndex) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) IntStream(java.util.stream.IntStream) BranchDto(org.sonar.db.component.BranchDto) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) SCAN_EXECUTION(org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION) ComponentTesting.newBranchDto(org.sonar.db.component.ComponentTesting.newBranchDto) FavoriteUpdater(org.sonar.server.favorite.FavoriteUpdater) UserDto(org.sonar.db.user.UserDto) RunWith(org.junit.runner.RunWith) PROVISION_PROJECTS(org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS) Mockito.spy(org.mockito.Mockito.spy) ProjectDefaultVisibility(org.sonar.server.project.ProjectDefaultVisibility) Answer(org.mockito.stubbing.Answer) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Before(org.junit.Before) ComponentUpdater(org.sonar.server.component.ComponentUpdater) UserSessionRule(org.sonar.server.tester.UserSessionRule) Collections.emptyMap(java.util.Collections.emptyMap) BranchType(org.sonar.db.component.BranchType) RandomStringUtils.randomAlphabetic(org.apache.commons.lang.RandomStringUtils.randomAlphabetic) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) CeQueueImpl(org.sonar.ce.queue.CeQueueImpl) Mockito.verify(org.mockito.Mockito.verify) ComponentTesting.newPrivateProjectDto(org.sonar.db.component.ComponentTesting.newPrivateProjectDto) Rule(org.junit.Rule) CeTaskSubmit(org.sonar.ce.queue.CeTaskSubmit) InputStream(java.io.InputStream) CeQueue(org.sonar.ce.queue.CeQueue) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) DbSession(org.sonar.db.DbSession) BranchDto(org.sonar.db.component.BranchDto) ComponentTesting.newBranchDto(org.sonar.db.component.ComponentTesting.newBranchDto) InputStream(java.io.InputStream) UserDto(org.sonar.db.user.UserDto) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Example 4 with PROVISION_PROJECTS

use of org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS in project sonarqube by SonarSource.

the class ReportSubmitterTest method provision_project_if_does_not_exist.

@Test
public void provision_project_if_does_not_exist() {
    userSession.addPermission(GlobalPermission.SCAN).addPermission(PROVISION_PROJECTS);
    mockSuccessfulPrepareSubmitCall();
    when(permissionTemplateService.wouldUserHaveScanPermissionWithDefaultTemplate(any(DbSession.class), any(), eq(PROJECT_KEY))).thenReturn(true);
    when(permissionTemplateService.hasDefaultTemplateWithPermissionOnProjectCreator(any(DbSession.class), any(ComponentDto.class))).thenReturn(true);
    underTest.submit(PROJECT_KEY, PROJECT_NAME, emptyMap(), IOUtils.toInputStream("{binary}"));
    ComponentDto createdProject = db.getDbClient().componentDao().selectByKey(db.getSession(), PROJECT_KEY).get();
    verifyReportIsPersisted(TASK_UUID);
    verify(queue).submit(argThat(submit -> submit.getType().equals(CeTaskTypes.REPORT) && submit.getComponent().filter(cpt -> cpt.getUuid().equals(createdProject.uuid()) && cpt.getMainComponentUuid().equals(createdProject.uuid())).isPresent() && submit.getUuid().equals(TASK_UUID)));
}
Also used : CeTaskTypes(org.sonar.db.ce.CeTaskTypes) IntStream.rangeClosed(java.util.stream.IntStream.rangeClosed) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) GlobalPermission(org.sonar.db.permission.GlobalPermission) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Random(java.util.Random) DbSession(org.sonar.db.DbSession) BadRequestException(org.sonar.server.exceptions.BadRequestException) Mockito.verifyNoInteractions(org.mockito.Mockito.verifyNoInteractions) SCAN(org.sonar.db.permission.GlobalPermission.SCAN) Map(java.util.Map) Visibility(org.sonar.server.project.Visibility) DbTester(org.sonar.db.DbTester) System2(org.sonar.api.utils.System2) StandardCharsets(java.nio.charset.StandardCharsets) String.format(java.lang.String.format) PermissionTemplateService(org.sonar.server.permission.PermissionTemplateService) IOUtils(org.apache.commons.io.IOUtils) ComponentDto(org.sonar.db.component.ComponentDto) ForbiddenException(org.sonar.server.exceptions.ForbiddenException) MoreCollectors.uniqueIndex(org.sonar.core.util.stream.MoreCollectors.uniqueIndex) Mockito.mock(org.mockito.Mockito.mock) IntStream(java.util.stream.IntStream) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) SCAN_EXECUTION(org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION) FavoriteUpdater(org.sonar.server.favorite.FavoriteUpdater) UserDto(org.sonar.db.user.UserDto) I18n(org.sonar.core.i18n.I18n) PROVISION_PROJECTS(org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS) ProjectDefaultVisibility(org.sonar.server.project.ProjectDefaultVisibility) TestProjectIndexers(org.sonar.server.es.TestProjectIndexers) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Before(org.junit.Before) ComponentUpdater(org.sonar.server.component.ComponentUpdater) UserSessionRule(org.sonar.server.tester.UserSessionRule) Collections.emptyMap(java.util.Collections.emptyMap) RandomStringUtils.randomAlphabetic(org.apache.commons.lang.RandomStringUtils.randomAlphabetic) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) CeQueueImpl(org.sonar.ce.queue.CeQueueImpl) SequenceUuidFactory(org.sonar.core.util.SequenceUuidFactory) Mockito.verify(org.mockito.Mockito.verify) Rule(org.junit.Rule) CeTaskSubmit(org.sonar.ce.queue.CeTaskSubmit) InputStream(java.io.InputStream) CeQueue(org.sonar.ce.queue.CeQueue) ComponentTesting.newModuleDto(org.sonar.db.component.ComponentTesting.newModuleDto) DbSession(org.sonar.db.DbSession) ComponentDto(org.sonar.db.component.ComponentDto) Test(org.junit.Test)

Example 5 with PROVISION_PROJECTS

use of org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS in project sonarqube by SonarSource.

the class SearchAzureReposAction method doHandle.

private SearchAzureReposWsResponse doHandle(Request request) {
    try (DbSession dbSession = dbClient.openSession(false)) {
        userSession.checkLoggedIn().checkPermission(PROVISION_PROJECTS);
        String almSettingKey = request.mandatoryParam(PARAM_ALM_SETTING);
        String userUuid = requireNonNull(userSession.getUuid(), "User UUID cannot be null");
        AlmSettingDto almSettingDto = dbClient.almSettingDao().selectByKey(dbSession, almSettingKey).orElseThrow(() -> new NotFoundException(String.format("ALM Setting '%s' not found", almSettingKey)));
        Optional<AlmPatDto> almPatDto = dbClient.almPatDao().selectByUserAndAlmSetting(dbSession, userUuid, almSettingDto);
        String projectKey = request.param(PARAM_PROJECT_NAME);
        String searchQuery = request.param(PARAM_SEARCH_QUERY);
        String pat = almPatDto.map(AlmPatDto::getPersonalAccessToken).orElseThrow(() -> new IllegalArgumentException("No personal access token found"));
        String url = requireNonNull(almSettingDto.getUrl(), "ALM url cannot be null");
        GsonAzureRepoList gsonAzureRepoList = azureDevOpsHttpClient.getRepos(url, pat, projectKey);
        Map<ProjectKeyName, ProjectDto> sqProjectsKeyByAzureKey = getSqProjectsKeyByCustomKey(dbSession, almSettingDto, gsonAzureRepoList);
        List<AzureRepo> repositories = gsonAzureRepoList.getValues().stream().filter(r -> isSearchOnlyByProjectName(searchQuery) || doesSearchCriteriaMatchProjectOrRepo(r, searchQuery)).map(repo -> toAzureRepo(repo, sqProjectsKeyByAzureKey)).sorted(comparing(AzureRepo::getName, String::compareToIgnoreCase)).collect(toList());
        LOG.debug(repositories.toString());
        return SearchAzureReposWsResponse.newBuilder().addAllRepositories(repositories).build();
    }
}
Also used : ProjectDto(org.sonar.db.project.ProjectDto) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) StringUtils.containsIgnoreCase(org.apache.commons.lang.StringUtils.containsIgnoreCase) PROVISION_PROJECTS(org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS) Function(java.util.function.Function) DbSession(org.sonar.db.DbSession) GsonAzureRepoList(org.sonar.alm.client.azure.GsonAzureRepoList) Request(org.sonar.api.server.ws.Request) Loggers(org.sonar.api.utils.log.Loggers) WebService(org.sonar.api.server.ws.WebService) ProjectAlmSettingDto(org.sonar.db.alm.setting.ProjectAlmSettingDto) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) Objects.requireNonNull(java.util.Objects.requireNonNull) Response(org.sonar.api.server.ws.Response) Comparator.comparing(java.util.Comparator.comparing) AlmPatDto(org.sonar.db.alm.pat.AlmPatDto) Nullable(javax.annotation.Nullable) Logger(org.sonar.api.utils.log.Logger) Collectors.toSet(java.util.stream.Collectors.toSet) Set(java.util.Set) Collectors(java.util.stream.Collectors) BinaryOperator(java.util.function.BinaryOperator) NotFoundException(org.sonar.server.exceptions.NotFoundException) Objects(java.util.Objects) DbClient(org.sonar.db.DbClient) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ProjectDto(org.sonar.db.project.ProjectDto) Optional(java.util.Optional) GsonAzureRepo(org.sonar.alm.client.azure.GsonAzureRepo) AlmIntegrationsWsAction(org.sonar.server.almintegration.ws.AlmIntegrationsWsAction) UserSession(org.sonar.server.user.UserSession) SearchAzureReposWsResponse(org.sonarqube.ws.AlmIntegrations.SearchAzureReposWsResponse) AzureDevOpsHttpClient(org.sonar.alm.client.azure.AzureDevOpsHttpClient) AzureRepo(org.sonarqube.ws.AlmIntegrations.AzureRepo) WsUtils.writeProtobuf(org.sonar.server.ws.WsUtils.writeProtobuf) GsonAzureRepo(org.sonar.alm.client.azure.GsonAzureRepo) AzureRepo(org.sonarqube.ws.AlmIntegrations.AzureRepo) AlmPatDto(org.sonar.db.alm.pat.AlmPatDto) NotFoundException(org.sonar.server.exceptions.NotFoundException) DbSession(org.sonar.db.DbSession) GsonAzureRepoList(org.sonar.alm.client.azure.GsonAzureRepoList) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) ProjectAlmSettingDto(org.sonar.db.alm.setting.ProjectAlmSettingDto)

Aggregations

DbSession (org.sonar.db.DbSession)8 PROVISION_PROJECTS (org.sonar.db.permission.GlobalPermission.PROVISION_PROJECTS)8 Map (java.util.Map)7 List (java.util.List)5 Optional (java.util.Optional)5 Request (org.sonar.api.server.ws.Request)5 Response (org.sonar.api.server.ws.Response)5 WebService (org.sonar.api.server.ws.WebService)5 DbClient (org.sonar.db.DbClient)5 Objects.requireNonNull (java.util.Objects.requireNonNull)4 Set (java.util.Set)4 BinaryOperator (java.util.function.BinaryOperator)4 Collectors.toList (java.util.stream.Collectors.toList)4 Collectors.toSet (java.util.stream.Collectors.toSet)4 InputStream (java.io.InputStream)3 StandardCharsets (java.nio.charset.StandardCharsets)3 Collections.emptyMap (java.util.Collections.emptyMap)3 Random (java.util.Random)3 IntStream (java.util.stream.IntStream)3 AlmSettingDto (org.sonar.db.alm.setting.AlmSettingDto)3