]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13999 remove some organization WS
authorMichal Duda <michal.duda@sonarsource.com>
Tue, 15 Dec 2020 12:36:18 +0000 (13:36 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 22 Dec 2020 20:09:37 +0000 (20:09 +0000)
16 files changed:
server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganisationSupport.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/AddMemberAction.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/CreateAction.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/EnableSupportAction.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/OrganizationsWsModule.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/PreventUserDeletionAction.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/RemoveMemberAction.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java [deleted file]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/organization/ws/OrganizationDeleterTest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/OrganizationsService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java [deleted file]
sonar-ws/src/main/protobuf/ws-organizations.proto

diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganisationSupport.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganisationSupport.java
deleted file mode 100644 (file)
index e507928..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.List;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.server.ServerSide;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.permission.GroupPermissionDto;
-import org.sonar.db.permission.template.PermissionTemplateGroupDto;
-import org.sonar.db.rule.RuleDefinitionDto;
-import org.sonar.db.user.GroupDto;
-import org.sonar.server.rule.index.RuleIndexer;
-import org.sonar.server.usergroups.DefaultGroupCreator;
-import org.sonar.server.usergroups.DefaultGroupFinder;
-
-import static org.sonar.core.util.stream.MoreCollectors.toList;
-
-//TODO drop this
-@Deprecated
-@ServerSide
-public class OrganisationSupport {
-  private final DbClient dbClient;
-  private final OrganizationFlags organizationFlags;
-  private final DefaultGroupCreator defaultGroupCreator;
-  private final DefaultGroupFinder defaultGroupFinder;
-  private final RuleIndexer ruleIndexer;
-  private final UuidFactory uuidFactory;
-
-  public OrganisationSupport(DbClient dbClient,
-    OrganizationFlags organizationFlags, DefaultGroupCreator defaultGroupCreator, DefaultGroupFinder defaultGroupFinder,
-    RuleIndexer ruleIndexer, UuidFactory uuidFactory) {
-    this.dbClient = dbClient;
-    this.organizationFlags = organizationFlags;
-    this.defaultGroupCreator = defaultGroupCreator;
-    this.defaultGroupFinder = defaultGroupFinder;
-    this.ruleIndexer = ruleIndexer;
-    this.uuidFactory = uuidFactory;
-  }
-
-  public void enable(String login) {
-    try (DbSession dbSession = dbClient.openSession(false)) {
-      if (!organizationFlags.isEnabled(dbSession)) {
-        flagAdminUserAsRoot(dbSession, login);
-        createDefaultMembersGroup(dbSession);
-        List<String> disabledTemplateAndCustomRuleUuids = disableTemplateRulesAndCustomRules(dbSession);
-        enableFeature(dbSession);
-        ruleIndexer.commitAndIndex(dbSession, disabledTemplateAndCustomRuleUuids);
-      }
-    }
-  }
-
-  private void flagAdminUserAsRoot(DbSession dbSession, String login) {
-    dbClient.userDao().setRoot(dbSession, login, true);
-  }
-
-  private void createDefaultMembersGroup(DbSession dbSession) {
-    GroupDto sonarUsersGroup = defaultGroupFinder.findDefaultGroup(dbSession);
-    GroupDto members = defaultGroupCreator.create(dbSession);
-    copySonarUsersGroupPermissionsToMembersGroup(dbSession, sonarUsersGroup, members);
-    copySonarUsersGroupPermissionTemplatesToMembersGroup(dbSession, sonarUsersGroup, members);
-  }
-
-  private void copySonarUsersGroupPermissionsToMembersGroup(DbSession dbSession, GroupDto sonarUsersGroup, GroupDto membersGroup) {
-    dbClient.groupPermissionDao().selectAllPermissionsByGroupUuid(dbSession, sonarUsersGroup.getUuid(),
-      context -> {
-        GroupPermissionDto groupPermissionDto = context.getResultObject();
-        dbClient.groupPermissionDao().insert(dbSession,
-          new GroupPermissionDto()
-            .setUuid(uuidFactory.create())
-            .setGroupUuid(membersGroup.getUuid())
-            .setRole(groupPermissionDto.getRole())
-            .setComponentUuid(groupPermissionDto.getComponentUuid()));
-      });
-  }
-
-  private void copySonarUsersGroupPermissionTemplatesToMembersGroup(DbSession dbSession, GroupDto sonarUsersGroup, GroupDto membersGroup) {
-    List<PermissionTemplateGroupDto> sonarUsersPermissionTemplates = dbClient.permissionTemplateDao().selectAllGroupPermissionTemplatesByGroupUuid(dbSession,
-      sonarUsersGroup.getUuid());
-    sonarUsersPermissionTemplates.forEach(permissionTemplateGroup -> dbClient.permissionTemplateDao().insertGroupPermission(dbSession,
-      permissionTemplateGroup.getTemplateUuid(), membersGroup.getUuid(), permissionTemplateGroup.getPermission()));
-  }
-
-  private List<String> disableTemplateRulesAndCustomRules(DbSession dbSession) {
-    List<RuleDefinitionDto> rules = dbClient.ruleDao().selectAllDefinitions(dbSession).stream()
-      .filter(r -> r.isTemplate() || r.isCustomRule())
-      .collect(toList());
-    rules.forEach(r -> {
-      r.setStatus(RuleStatus.REMOVED);
-      dbClient.ruleDao().update(dbSession, r);
-    });
-    return rules.stream().map(RuleDefinitionDto::getUuid).collect(toList());
-  }
-
-  private void enableFeature(DbSession dbSession) {
-    organizationFlags.enable(dbSession);
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/AddMemberAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/AddMemberAction.java
deleted file mode 100644 (file)
index c044754..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.ws;
-
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.api.server.ws.WebService.NewController;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.organization.OrganizationDto;
-import org.sonar.db.permission.GlobalPermission;
-import org.sonar.db.user.GroupMembershipQuery;
-import org.sonar.db.user.UserDto;
-import org.sonar.server.issue.AvatarResolver;
-import org.sonar.server.organization.MemberUpdater;
-import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.Organizations.AddMemberWsResponse;
-import org.sonarqube.ws.Organizations.User;
-
-import static com.google.common.base.Strings.emptyToNull;
-import static java.util.Optional.ofNullable;
-import static org.sonar.db.user.GroupMembershipQuery.IN;
-import static org.sonar.server.exceptions.NotFoundException.checkFound;
-import static org.sonar.server.exceptions.NotFoundException.checkFoundWithOptional;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_LOGIN;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_ORGANIZATION;
-import static org.sonar.server.ws.KeyExamples.KEY_ORG_EXAMPLE_001;
-import static org.sonar.server.ws.WsUtils.writeProtobuf;
-
-//TODO remove when getting rid of organizations
-@Deprecated
-public class AddMemberAction implements OrganizationsWsAction {
-  private final DbClient dbClient;
-  private final UserSession userSession;
-  private final AvatarResolver avatarResolver;
-  private final OrganizationsWsSupport wsSupport;
-  private final MemberUpdater memberUpdater;
-
-  public AddMemberAction(DbClient dbClient, UserSession userSession, AvatarResolver avatarResolver, OrganizationsWsSupport wsSupport,
-    MemberUpdater memberUpdater) {
-    this.dbClient = dbClient;
-    this.userSession = userSession;
-    this.avatarResolver = avatarResolver;
-    this.wsSupport = wsSupport;
-    this.memberUpdater = memberUpdater;
-  }
-
-  @Override
-  public void define(NewController context) {
-    WebService.NewAction action = context.createAction("add_member")
-      .setDescription("Add a user as a member of an organization.<br>" +
-        "Requires 'Administer System' permission on the specified organization.")
-      .setSince("6.4")
-      .setPost(true)
-      .setInternal(true)
-      .setResponseExample(getClass().getResource("add_member-example.json"))
-      .setHandler(this);
-
-    action
-      .createParam(PARAM_ORGANIZATION)
-      .setDescription("Organization key")
-      .setRequired(true)
-      .setExampleValue(KEY_ORG_EXAMPLE_001);
-
-    action
-      .createParam(PARAM_LOGIN)
-      .setDescription("User login")
-      .setRequired(true)
-      .setExampleValue("ray.bradbury");
-  }
-
-  @Override
-  public void handle(Request request, Response response) throws Exception {
-    String organizationKey = request.mandatoryParam(PARAM_ORGANIZATION);
-    String login = request.mandatoryParam(PARAM_LOGIN);
-
-    try (DbSession dbSession = dbClient.openSession(false)) {
-      OrganizationDto organization = checkFoundWithOptional(dbClient.organizationDao().selectByKey(dbSession, organizationKey), "Organization '%s' is not found",
-        organizationKey);
-      userSession.checkPermission(GlobalPermission.ADMINISTER);
-      wsSupport.checkMemberSyncIsDisabled(dbSession, organization);
-      UserDto user = checkFound(dbClient.userDao().selectByLogin(dbSession, login), "User '%s' is not found", login);
-      memberUpdater.addMember(dbSession, user);
-
-      int groups = dbClient.groupMembershipDao().countGroups(dbSession, GroupMembershipQuery.builder().membership(IN).build(), user.getUuid());
-      AddMemberWsResponse wsResponse = buildResponse(user, groups);
-      writeProtobuf(wsResponse, request, response);
-    }
-  }
-
-  private AddMemberWsResponse buildResponse(UserDto user, int groups) {
-    AddMemberWsResponse.Builder response = AddMemberWsResponse.newBuilder();
-    User.Builder wsUser = User.newBuilder()
-      .setLogin(user.getLogin())
-      .setGroupCount(groups);
-    ofNullable(emptyToNull(user.getEmail())).ifPresent(text -> wsUser.setAvatar(avatarResolver.create(user)));
-    ofNullable(user.getName()).ifPresent(wsUser::setName);
-    response.setUser(wsUser);
-    return response.build();
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/CreateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/CreateAction.java
deleted file mode 100644 (file)
index 6b971a0..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.ws;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.server.ws.Change;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.core.config.CorePropertyDefinitions;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.organization.OrganizationDto;
-import org.sonar.db.user.UserDto;
-import org.sonar.server.organization.OrganizationAlmBinding;
-import org.sonar.server.organization.OrganizationFlags;
-import org.sonar.server.organization.OrganizationUpdater;
-import org.sonar.server.organization.OrganizationValidation;
-import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.Organizations.CreateWsResponse;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.server.organization.OrganizationUpdater.NewOrganization.newOrganizationBuilder;
-import static org.sonar.server.organization.OrganizationValidation.KEY_MAX_LENGTH;
-import static org.sonar.server.organization.OrganizationValidation.KEY_MIN_LENGTH;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_KEY;
-import static org.sonar.server.ws.WsUtils.writeProtobuf;
-
-public class CreateAction implements OrganizationsWsAction {
-
-  private static final String ACTION = "create";
-  private static final String PARAM_INSTALLATION_ID = "installationId";
-
-  private final Configuration config;
-  private final UserSession userSession;
-  private final DbClient dbClient;
-  private final OrganizationsWsSupport wsSupport;
-  private final OrganizationValidation organizationValidation;
-  private final OrganizationUpdater organizationUpdater;
-  private final OrganizationFlags organizationFlags;
-  @CheckForNull
-  private final OrganizationAlmBinding organizationAlmBinding;
-
-  public CreateAction(Configuration config, UserSession userSession, DbClient dbClient, OrganizationsWsSupport wsSupport,
-    OrganizationValidation organizationValidation, OrganizationUpdater organizationUpdater, OrganizationFlags organizationFlags,
-    @Nullable OrganizationAlmBinding organizationAlmBinding) {
-    this.config = config;
-    this.userSession = userSession;
-    this.dbClient = dbClient;
-    this.wsSupport = wsSupport;
-    this.organizationValidation = organizationValidation;
-    this.organizationUpdater = organizationUpdater;
-    this.organizationFlags = organizationFlags;
-    this.organizationAlmBinding = organizationAlmBinding;
-  }
-
-  public CreateAction(Configuration config, UserSession userSession, DbClient dbClient, OrganizationsWsSupport wsSupport,
-    OrganizationValidation organizationValidation, OrganizationUpdater organizationUpdater, OrganizationFlags organizationFlags) {
-    this(config, userSession, dbClient, wsSupport, organizationValidation, organizationUpdater, organizationFlags, null);
-  }
-
-  @Override
-  public void define(WebService.NewController context) {
-    WebService.NewAction action = context.createAction(ACTION)
-      .setPost(true)
-      .setDescription("Create an organization.<br />" +
-        "Requires 'Administer System' permission unless any logged in user is allowed to create an organization (see appropriate setting). Organization support must be enabled.")
-      .setResponseExample(getClass().getResource("create-example.json"))
-      .setInternal(true)
-      .setSince("6.2")
-      .setChangelog(
-        new Change("7.4", "Maximal number of character of name and key is 300 characters"),
-        new Change("7.2", "Minimal number of character of name and key is one character"))
-      .setHandler(this);
-
-    action.createParam(PARAM_KEY)
-      .setRequired(false)
-      .setMinimumLength(KEY_MIN_LENGTH)
-      .setMaximumLength(KEY_MAX_LENGTH)
-      .setDescription("Key of the organization. <br />" +
-        "The key is unique to the whole SonarQube. <br/>" +
-        "When not specified, the key is computed from the name. <br />" +
-        "All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading)")
-      .setExampleValue("foo-company");
-    action.createParam(PARAM_INSTALLATION_ID)
-      .setRequired(false)
-      .setInternal(true)
-      .setDescription("Installation ID of the GitHub/Bitbucket application")
-      .setExampleValue("387133");
-
-    wsSupport.addOrganizationDetailsParams(action, true);
-  }
-
-  @Override
-  public void handle(Request request, Response response) throws Exception {
-    if (config.getBoolean(CorePropertyDefinitions.ORGANIZATIONS_ANYONE_CAN_CREATE).orElse(false)) {
-      userSession.checkLoggedIn();
-    } else {
-      userSession.checkIsSystemAdministrator();
-    }
-
-    String name = wsSupport.getAndCheckMandatoryName(request);
-    String requestKey = getAndCheckKey(request);
-    String key = useOrGenerateKey(requestKey, name);
-    String description = wsSupport.getAndCheckDescription(request);
-    String url = wsSupport.getAndCheckUrl(request);
-    String avatar = wsSupport.getAndCheckAvatar(request);
-
-    try (DbSession dbSession = dbClient.openSession(false)) {
-      organizationFlags.checkEnabled(dbSession);
-      UserDto currentUser = requireNonNull(dbClient.userDao().selectActiveUserByLogin(dbSession, requireNonNull(userSession.getLogin())));
-      OrganizationDto organization = organizationUpdater.create(
-        dbSession,
-        currentUser,
-        newOrganizationBuilder()
-          .setName(name)
-          .setKey(key)
-          .setDescription(description)
-          .setUrl(url)
-          .setAvatarUrl(avatar)
-          .build(),
-        o -> bindOrganization(request, dbSession, o));
-
-      writeResponse(request, response, organization);
-    } catch (OrganizationUpdater.KeyConflictException e) {
-      checkArgument(requestKey == null, "Key '%s' is already used. Specify another one.", key);
-      checkArgument(requestKey != null, "Key '%s' generated from name '%s' is already used. Specify one.", key, name);
-    }
-  }
-
-  private void bindOrganization(Request request, DbSession dbSession, OrganizationDto organization) {
-    if (organizationAlmBinding == null) {
-      return;
-    }
-    String installationId = request.param(PARAM_INSTALLATION_ID);
-    if (installationId == null) {
-      return;
-    }
-    organizationAlmBinding.bindOrganization(dbSession, organization, installationId, true);
-  }
-
-  @CheckForNull
-  private String getAndCheckKey(Request request) {
-    String rqstKey = request.param(PARAM_KEY);
-    if (rqstKey != null) {
-      return organizationValidation.checkKey(rqstKey);
-    }
-    return rqstKey;
-  }
-
-  private String useOrGenerateKey(@Nullable String key, String name) {
-    if (key == null) {
-      return organizationValidation.generateKeyFrom(name);
-    }
-    return key;
-  }
-
-  private void writeResponse(Request request, Response response, OrganizationDto dto) {
-    writeProtobuf(
-      CreateWsResponse.newBuilder().setOrganization(wsSupport.toOrganization(dto)).build(),
-      request,
-      response);
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/EnableSupportAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/EnableSupportAction.java
deleted file mode 100644 (file)
index dc8a570..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.ws;
-
-import org.sonar.api.server.ws.Change;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.db.permission.GlobalPermission;
-import org.sonar.server.organization.DefaultOrganizationProvider;
-import org.sonar.server.organization.OrganisationSupport;
-import org.sonar.server.user.UserSession;
-
-import static java.util.Objects.requireNonNull;
-
-public class EnableSupportAction implements OrganizationsWsAction {
-  private static final String ACTION = "enable_support";
-
-  private final UserSession userSession;
-  private final DefaultOrganizationProvider defaultOrganizationProvider;
-  private final OrganisationSupport organisationSupport;
-
-  public EnableSupportAction(UserSession userSession, DefaultOrganizationProvider defaultOrganizationProvider, OrganisationSupport organisationSupport) {
-    this.userSession = userSession;
-    this.defaultOrganizationProvider = defaultOrganizationProvider;
-    this.organisationSupport = organisationSupport;
-  }
-
-  @Override
-  public void define(WebService.NewController context) {
-    context.createAction(ACTION)
-      .setPost(true)
-      .setDescription("Enable support of organizations.<br />" +
-        "'Administer System' permission is required. The logged-in user will be flagged as root and will be able to manage organizations and other root users.")
-      .setInternal(true)
-      .setPost(true)
-      .setSince("6.3")
-      .setChangelog(new Change("6.4", "Create default 'Members' group"))
-      .setHandler(this);
-  }
-
-  @Override
-  public void handle(Request request, Response response) throws Exception {
-    verifySystemAdministrator();
-
-    organisationSupport.enable(requireNonNull(userSession.getLogin()));
-    response.noContent();
-  }
-
-  private void verifySystemAdministrator() {
-    userSession.checkLoggedIn().checkPermission(GlobalPermission.ADMINISTER);
-  }
-
-}
index 26e0ffd2704ccbf151a25b4eb7b0d0953fae4462..4a9a05264679fac258d8f38194ce8863eae7aedc 100644 (file)
  */
 package org.sonar.server.organization.ws;
 
-import org.sonar.api.config.Configuration;
 import org.sonar.core.platform.Module;
 import org.sonar.server.organization.MemberUpdater;
-import org.sonar.server.organization.OrganisationSupport;
-
-import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED;
 
 public class OrganizationsWsModule extends Module {
 
-  private final Configuration config;
-
-  public OrganizationsWsModule(Configuration config) {
-    this.config = config;
+  public OrganizationsWsModule() {
+    // nothing to do here
   }
 
   @Override
@@ -43,17 +37,6 @@ public class OrganizationsWsModule extends Module {
       // actions
       SearchAction.class,
       SearchMembersAction.class);
-
-    if (config.getBoolean(SONARCLOUD_ENABLED.getKey()).orElse(false)) {
-      add(
-        OrganisationSupport.class,
-        EnableSupportAction.class,
-        AddMemberAction.class,
-        CreateAction.class,
-        RemoveMemberAction.class,
-        UpdateAction.class,
-        PreventUserDeletionAction.class);
-    }
   }
 
 }
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/PreventUserDeletionAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/PreventUserDeletionAction.java
deleted file mode 100644 (file)
index b221930..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.ws;
-
-import java.util.List;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.organization.OrganizationDto;
-import org.sonar.db.organization.OrganizationHelper;
-import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.Organizations;
-
-import static org.sonar.server.ws.WsUtils.writeProtobuf;
-
-public class PreventUserDeletionAction implements OrganizationsWsAction {
-
-  private static final String ACTION = "prevent_user_deletion";
-
-  private final DbClient dbClient;
-  private final UserSession userSession;
-
-  public PreventUserDeletionAction(DbClient dbClient, UserSession userSession) {
-    this.dbClient = dbClient;
-    this.userSession = userSession;
-  }
-
-  @Override
-  public void define(WebService.NewController context) {
-    context.createAction(ACTION)
-      .setPost(false)
-      .setDescription("List organizations that prevent the deletion of the authenticated user.")
-      .setResponseExample(getClass().getResource("prevent_user_deletion-example.json"))
-      .setInternal(true)
-      .setSince("7.9")
-      .setHandler(this);
-  }
-
-  @Override
-  public void handle(Request request, Response response) throws Exception {
-    userSession.checkLoggedIn();
-
-    try (DbSession dbSession = dbClient.openSession(false)) {
-      String userUuid = userSession.getUuid();
-      List<OrganizationDto> organizationsThatPreventUserDeletion = new OrganizationHelper(dbClient).selectOrganizationsWithLastAdmin(dbSession, userUuid);
-
-      Organizations.PreventUserDeletionWsResponse wsResponse = buildResponse(organizationsThatPreventUserDeletion);
-      writeProtobuf(wsResponse, request, response);
-    }
-  }
-
-  private static Organizations.PreventUserDeletionWsResponse buildResponse(List<OrganizationDto> organizations) {
-    Organizations.PreventUserDeletionWsResponse.Builder response = Organizations.PreventUserDeletionWsResponse.newBuilder();
-    Organizations.PreventUserDeletionWsResponse.Organization.Builder wsOrganization = Organizations.PreventUserDeletionWsResponse.Organization.newBuilder();
-    organizations.forEach(o -> {
-        wsOrganization.clear();
-        response.addOrganizations(toOrganization(wsOrganization, o));
-      });
-    return response.build();
-  }
-
-  private static Organizations.PreventUserDeletionWsResponse.Organization.Builder toOrganization(
-    Organizations.PreventUserDeletionWsResponse.Organization.Builder builder, OrganizationDto organization) {
-    return builder
-      .setName(organization.getName())
-      .setKey(organization.getKey());
-  }
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/RemoveMemberAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/RemoveMemberAction.java
deleted file mode 100644 (file)
index 78e80b6..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.ws;
-
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.api.server.ws.WebService.NewController;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.organization.OrganizationDto;
-import org.sonar.db.user.UserDto;
-import org.sonar.server.organization.MemberUpdater;
-import org.sonar.server.user.UserSession;
-
-import static org.sonar.db.permission.GlobalPermission.ADMINISTER;
-import static org.sonar.server.exceptions.NotFoundException.checkFound;
-import static org.sonar.server.exceptions.NotFoundException.checkFoundWithOptional;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_LOGIN;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_ORGANIZATION;
-import static org.sonar.server.ws.KeyExamples.KEY_ORG_EXAMPLE_001;
-
-public class RemoveMemberAction implements OrganizationsWsAction {
-  private final DbClient dbClient;
-  private final UserSession userSession;
-  private final OrganizationsWsSupport wsSupport;
-  private final MemberUpdater memberUpdater;
-
-  public RemoveMemberAction(DbClient dbClient, UserSession userSession, OrganizationsWsSupport wsSupport,
-    MemberUpdater memberUpdater) {
-    this.dbClient = dbClient;
-    this.userSession = userSession;
-    this.wsSupport = wsSupport;
-    this.memberUpdater = memberUpdater;
-  }
-
-  @Override
-  public void define(NewController context) {
-    WebService.NewAction action = context.createAction("remove_member")
-      .setDescription("Remove a member from an organization.<br>" +
-        "Requires 'Administer System' permission on the specified organization.")
-      .setSince("6.4")
-      .setPost(true)
-      .setInternal(true)
-      .setHandler(this);
-
-    action
-      .createParam(PARAM_ORGANIZATION)
-      .setDescription("Organization key")
-      .setRequired(true)
-      .setExampleValue(KEY_ORG_EXAMPLE_001);
-
-    action
-      .createParam(PARAM_LOGIN)
-      .setDescription("User login")
-      .setRequired(true)
-      .setExampleValue("ray.bradbury");
-  }
-
-  @Override
-  public void handle(Request request, Response response) throws Exception {
-    String organizationKey = request.mandatoryParam(PARAM_ORGANIZATION);
-    String login = request.mandatoryParam(PARAM_LOGIN);
-
-    try (DbSession dbSession = dbClient.openSession(false)) {
-      OrganizationDto organization = checkFoundWithOptional(dbClient.organizationDao().selectByKey(dbSession, organizationKey),
-        "Organization '%s' is not found", organizationKey);
-      userSession.checkPermission(ADMINISTER);
-      wsSupport.checkMemberSyncIsDisabled(dbSession, organization);
-
-      UserDto user = checkFound(dbClient.userDao().selectActiveUserByLogin(dbSession, login), "User '%s' is not found", login);
-      memberUpdater.removeMember(dbSession, user);
-    }
-    response.noContent();
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java
deleted file mode 100644 (file)
index 2377a99..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.ws;
-
-import java.util.Optional;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.server.ws.Change;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.organization.OrganizationDto;
-import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.OrganizationFlags;
-import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.Organizations;
-
-import static java.lang.String.format;
-import static org.sonar.db.permission.GlobalPermission.ADMINISTER;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_AVATAR_URL;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_DESCRIPTION;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_KEY;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_NAME;
-import static org.sonar.server.organization.ws.OrganizationsWsSupport.PARAM_URL;
-import static org.sonar.server.ws.WsUtils.writeProtobuf;
-
-public class UpdateAction implements OrganizationsWsAction {
-  private static final String ACTION = "update";
-
-  private final UserSession userSession;
-  private final OrganizationsWsSupport wsSupport;
-  private final DbClient dbClient;
-  private final OrganizationFlags organizationFlags;
-
-  public UpdateAction(UserSession userSession, OrganizationsWsSupport wsSupport, DbClient dbClient,
-    OrganizationFlags organizationFlags) {
-    this.userSession = userSession;
-    this.wsSupport = wsSupport;
-    this.dbClient = dbClient;
-    this.organizationFlags = organizationFlags;
-  }
-
-  @Override
-  public void define(WebService.NewController context) {
-    WebService.NewAction action = context.createAction(ACTION)
-      .setPost(true)
-      .setDescription("Update an organization.<br/>" +
-        "Require 'Administer System' permission. Organization support must be enabled.")
-      .setInternal(true)
-      .setSince("6.2")
-      .setChangelog(new Change("7.4", "Maximal number of character of name is 300 characters"))
-      .setHandler(this);
-
-    action.createParam(PARAM_KEY)
-      .setRequired(true)
-      .setDescription("Organization key")
-      .setExampleValue("foo-company");
-
-    wsSupport.addOrganizationDetailsParams(action, false);
-  }
-
-  @Override
-  public void handle(Request request, Response response) throws Exception {
-    userSession.checkLoggedIn();
-
-    try (DbSession dbSession = dbClient.openSession(false)) {
-      organizationFlags.checkEnabled(dbSession);
-
-      String key = request.mandatoryParam(PARAM_KEY);
-
-      UpdateOrganizationRequest updateRequest = new UpdateOrganizationRequest(
-        request.getParam(PARAM_NAME, (rqt, paramKey) -> wsSupport.getAndCheckName(rqt)),
-        request.getParam(PARAM_DESCRIPTION, (rqt, paramKey) -> emptyAsNull(wsSupport.getAndCheckDescription(rqt))),
-        request.getParam(PARAM_URL, (rqt, paramKey) -> emptyAsNull(wsSupport.getAndCheckUrl(rqt))),
-        request.getParam(PARAM_AVATAR_URL, (rqt, paramKey) -> emptyAsNull(wsSupport.getAndCheckAvatar(rqt))));
-
-      OrganizationDto dto = getDto(dbSession, key);
-
-      userSession.checkPermission(ADMINISTER);
-
-      dto.setName(updateRequest.getName().or(dto::getName))
-        .setDescription(updateRequest.getDescription().or(dto::getDescription))
-        .setUrl(updateRequest.getUrl().or(dto::getUrl))
-        .setAvatarUrl(updateRequest.getAvatar().or(dto::getAvatarUrl));
-      dbClient.organizationDao().update(dbSession, dto);
-      dbSession.commit();
-
-      writeResponse(request, response, dto);
-    }
-  }
-
-  @CheckForNull
-  private static String emptyAsNull(@Nullable String value) {
-    if (value == null || value.isEmpty()) {
-      return null;
-    }
-    return value;
-  }
-
-  private OrganizationDto getDto(DbSession dbSession, String key) {
-    Optional<OrganizationDto> organizationDto = dbClient.organizationDao().selectByKey(dbSession, key);
-    if (!organizationDto.isPresent()) {
-      throw new NotFoundException(format("Organization not found for key '%s'", key));
-    }
-    return organizationDto.get();
-  }
-
-  private void writeResponse(Request request, Response response, OrganizationDto dto) {
-    writeProtobuf(
-      Organizations.UpdateWsResponse.newBuilder().setOrganization(wsSupport.toOrganization(dto)).build(),
-      request,
-      response);
-  }
-
-  private static final class UpdateOrganizationRequest {
-    private final Request.Param<String> name;
-    private final Request.Param<String> description;
-    private final Request.Param<String> url;
-    private final Request.Param<String> avatar;
-
-    private UpdateOrganizationRequest(Request.Param<String> name,
-      Request.Param<String> description,
-      Request.Param<String> url,
-      Request.Param<String> avatar) {
-      this.name = name;
-      this.description = description;
-      this.url = url;
-      this.avatar = avatar;
-    }
-
-    public Request.Param<String> getName() {
-      return name;
-    }
-
-    public Request.Param<String> getDescription() {
-      return description;
-    }
-
-    public Request.Param<String> getUrl() {
-      return url;
-    }
-
-    public Request.Param<String> getAvatar() {
-      return avatar;
-    }
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/organization/ws/OrganizationDeleterTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/organization/ws/OrganizationDeleterTest.java
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java
deleted file mode 100644 (file)
index 712089f..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.sonarqube.ws.client.organizations;
-
-import javax.annotation.Generated;
-
-/**
- * This is part of the internal API.
- * This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/add_member">Further information about this action online (including a response example)</a>
- * @since 6.4
- */
-@Generated("sonar-ws-generator")
-public class AddMemberRequest {
-
-  private String login;
-  private String organization;
-
-  /**
-   * This is a mandatory parameter.
-   * Example value: "ray.bradbury"
-   */
-  public AddMemberRequest setLogin(String login) {
-    this.login = login;
-    return this;
-  }
-
-  public String getLogin() {
-    return login;
-  }
-
-  /**
-   * This is a mandatory parameter.
-   * Example value: "my-org"
-   */
-  public AddMemberRequest setOrganization(String organization) {
-    this.organization = organization;
-    return this;
-  }
-
-  public String getOrganization() {
-    return organization;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java
deleted file mode 100644 (file)
index 3b043c9..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.sonarqube.ws.client.organizations;
-
-import javax.annotation.Generated;
-
-/**
- * This is part of the internal API.
- * This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/create">Further information about this action online (including a response example)</a>
- * @since 6.2
- */
-@Generated("sonar-ws-generator")
-public class CreateRequest {
-
-  private String avatar;
-  private String description;
-  private String key;
-  private String name;
-  private String url;
-
-  /**
-   * Example value: "https://www.foo.com/foo.png"
-   */
-  public CreateRequest setAvatar(String avatar) {
-    this.avatar = avatar;
-    return this;
-  }
-
-  public String getAvatar() {
-    return avatar;
-  }
-
-  /**
-   * Example value: "The Foo company produces quality software for Bar."
-   */
-  public CreateRequest setDescription(String description) {
-    this.description = description;
-    return this;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  /**
-   * Example value: "foo-company"
-   */
-  public CreateRequest setKey(String key) {
-    this.key = key;
-    return this;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  /**
-   * This is a mandatory parameter.
-   * Example value: "Foo Company"
-   */
-  public CreateRequest setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Example value: "https://www.foo.com"
-   */
-  public CreateRequest setUrl(String url) {
-    this.url = url;
-    return this;
-  }
-
-  public String getUrl() {
-    return url;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java
deleted file mode 100644 (file)
index 65890a3..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.sonarqube.ws.client.organizations;
-
-import javax.annotation.Generated;
-
-/**
- * This is part of the internal API.
- * This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/delete">Further information about this action online (including a response example)</a>
- * @since 6.2
- */
-@Generated("sonar-ws-generator")
-public class DeleteRequest {
-
-  private String organization;
-
-  /**
-   * This is a mandatory parameter.
-   * Example value: "foo-company"
-   */
-  public DeleteRequest setOrganization(String organization) {
-    this.organization = organization;
-    return this;
-  }
-
-  public String getOrganization() {
-    return organization;
-  }
-}
index d067cd8f3bfde1075cc5ce4b8076f09432ca53f8..fad2afd2bdca1fdf321c4820d399ec98e62f6d56 100644 (file)
@@ -22,15 +22,12 @@ package org.sonarqube.ws.client.organizations;
 import java.util.stream.Collectors;
 import javax.annotation.Generated;
 import org.sonarqube.ws.MediaTypes;
+import org.sonarqube.ws.Organizations.SearchMembersWsResponse;
+import org.sonarqube.ws.Organizations.SearchWsResponse;
 import org.sonarqube.ws.client.BaseService;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.PostRequest;
 import org.sonarqube.ws.client.WsConnector;
-import org.sonarqube.ws.Organizations.AddMemberWsResponse;
-import org.sonarqube.ws.Organizations.CreateWsResponse;
-import org.sonarqube.ws.Organizations.SearchWsResponse;
-import org.sonarqube.ws.Organizations.SearchMembersWsResponse;
-import org.sonarqube.ws.Organizations.UpdateWsResponse;
 
 /**
  * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations">Further information about this web service online</a>
@@ -42,54 +39,6 @@ public class OrganizationsService extends BaseService {
     super(wsConnector, "api/organizations");
   }
 
-  /**
-   *
-   * This is part of the internal API.
-   * This is a POST request.
-   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/add_member">Further information about this action online (including a response example)</a>
-   * @since 6.4
-   */
-  public AddMemberWsResponse addMember(AddMemberRequest request) {
-    return call(
-      new PostRequest(path("add_member"))
-        .setParam("login", request.getLogin())
-        .setParam("organization", request.getOrganization()),
-      AddMemberWsResponse.parser());
-  }
-
-  /**
-   *
-   * This is part of the internal API.
-   * This is a POST request.
-   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/create">Further information about this action online (including a response example)</a>
-   * @since 6.2
-   */
-  public CreateWsResponse create(CreateRequest request) {
-    return call(
-      new PostRequest(path("create"))
-        .setParam("avatar", request.getAvatar())
-        .setParam("description", request.getDescription())
-        .setParam("key", request.getKey())
-        .setParam("name", request.getName())
-        .setParam("url", request.getUrl()),
-      CreateWsResponse.parser());
-  }
-
-  /**
-   *
-   * This is part of the internal API.
-   * This is a POST request.
-   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/delete">Further information about this action online (including a response example)</a>
-   * @since 6.2
-   */
-  public void delete(DeleteRequest request) {
-    call(
-      new PostRequest(path("delete"))
-        .setParam("organization", request.getOrganization())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
-  }
-
   /**
    *
    * This is part of the internal API.
@@ -100,24 +49,7 @@ public class OrganizationsService extends BaseService {
   public void enableSupport() {
     call(
       new PostRequest(path("enable_support"))
-        .setMediaType(MediaTypes.JSON)
-      ).content();
-  }
-
-  /**
-   *
-   * This is part of the internal API.
-   * This is a POST request.
-   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/remove_member">Further information about this action online (including a response example)</a>
-   * @since 6.4
-   */
-  public void removeMember(RemoveMemberRequest request) {
-    call(
-      new PostRequest(path("remove_member"))
-        .setParam("login", request.getLogin())
-        .setParam("organization", request.getOrganization())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setMediaType(MediaTypes.JSON)).content();
   }
 
   /**
@@ -154,22 +86,4 @@ public class OrganizationsService extends BaseService {
         .setParam("selected", request.getSelected()),
       SearchMembersWsResponse.parser());
   }
-
-  /**
-   *
-   * This is part of the internal API.
-   * This is a POST request.
-   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/update">Further information about this action online (including a response example)</a>
-   * @since 6.2
-   */
-  public void update(UpdateRequest request) {
-    call(
-      new PostRequest(path("update"))
-        .setParam("avatar", request.getAvatar())
-        .setParam("description", request.getDescription())
-        .setParam("key", request.getKey())
-        .setParam("name", request.getName())
-        .setParam("url", request.getUrl()),
-      UpdateWsResponse.parser());
-  }
 }
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java
deleted file mode 100644 (file)
index 4cf728c..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.sonarqube.ws.client.organizations;
-
-import javax.annotation.Generated;
-
-/**
- * This is part of the internal API.
- * This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/remove_member">Further information about this action online (including a response example)</a>
- * @since 6.4
- */
-@Generated("sonar-ws-generator")
-public class RemoveMemberRequest {
-
-  private String login;
-  private String organization;
-
-  /**
-   * This is a mandatory parameter.
-   * Example value: "ray.bradbury"
-   */
-  public RemoveMemberRequest setLogin(String login) {
-    this.login = login;
-    return this;
-  }
-
-  public String getLogin() {
-    return login;
-  }
-
-  /**
-   * This is a mandatory parameter.
-   * Example value: "my-org"
-   */
-  public RemoveMemberRequest setOrganization(String organization) {
-    this.organization = organization;
-    return this;
-  }
-
-  public String getOrganization() {
-    return organization;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java
deleted file mode 100644 (file)
index 0cfb983..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2020 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.sonarqube.ws.client.organizations;
-
-import javax.annotation.Generated;
-
-/**
- * This is part of the internal API.
- * This is a POST request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/organizations/update">Further information about this action online (including a response example)</a>
- * @since 6.2
- */
-@Generated("sonar-ws-generator")
-public class UpdateRequest {
-
-  private String avatar;
-  private String description;
-  private String key;
-  private String name;
-  private String url;
-
-  /**
-   * Example value: "https://www.foo.com/foo.png"
-   */
-  public UpdateRequest setAvatar(String avatar) {
-    this.avatar = avatar;
-    return this;
-  }
-
-  public String getAvatar() {
-    return avatar;
-  }
-
-  /**
-   * Example value: "The Foo company produces quality software for Bar."
-   */
-  public UpdateRequest setDescription(String description) {
-    this.description = description;
-    return this;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  /**
-   * This is a mandatory parameter.
-   * Example value: "foo-company"
-   */
-  public UpdateRequest setKey(String key) {
-    this.key = key;
-    return this;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  /**
-   * Example value: "Foo Company"
-   */
-  public UpdateRequest setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Example value: "https://www.foo.com"
-   */
-  public UpdateRequest setUrl(String url) {
-    this.url = url;
-    return this;
-  }
-
-  public String getUrl() {
-    return url;
-  }
-}
index f16c6b7a40f7fb8b4a06ff242197a9659167ed52..d4a87d2b74d4f664c56c51a2323172a037838ce4 100644 (file)
@@ -26,16 +26,6 @@ option java_package = "org.sonarqube.ws";
 option java_outer_classname = "Organizations";
 option optimize_for = SPEED;
 
-// WS api/organizations/create
-message CreateWsResponse {
-  optional Organization organization = 1;
-}
-
-// WS api/organizations/update
-message UpdateWsResponse {
-  optional Organization organization = 1;
-}
-
 // WS api/organizations/search
 message SearchWsResponse {
   repeated Organization organizations = 1;
@@ -48,21 +38,6 @@ message SearchMembersWsResponse {
   repeated User users = 2;
 }
 
-// WS api/organizations/add_member
-message AddMemberWsResponse {
-  optional User user = 1;
-}
-
-// WS api/organizations/prevent_user_deletion
-message PreventUserDeletionWsResponse {
-  repeated Organization organizations = 1;
-
-  message Organization {
-    optional string key = 1;
-    optional string name = 2;
-  }
-}
-
 message Organization {
   optional string key = 1;
   optional string name = 2;