+++ /dev/null
-/*
- * 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);
- }
-
-}
+++ /dev/null
-/*
- * 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();
- }
-
-}
+++ /dev/null
-/*
- * 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);
- }
-
-}
+++ /dev/null
-/*
- * 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);
- }
-
-}
*/
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
// 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);
- }
}
}
+++ /dev/null
-/*
- * 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());
- }
-}
+++ /dev/null
-/*
- * 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();
- }
-
-}
+++ /dev/null
-/*
- * 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;
- }
- }
-
-}
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-}
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>
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.
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();
}
/**
.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());
- }
}
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-}
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;
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;