From 6cc33e5130fe97046e384a39beae29c01be4a005 Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 26 Mar 2020 17:40:13 +0100 Subject: [PATCH] SONAR-13249 deprecate usergroups id parameter --- .../java/org/sonar/server/usergroups/ws/AddUserAction.java | 2 +- .../org/sonar/server/usergroups/ws/GroupWsSupport.java | 3 ++- .../org/sonar/server/usergroups/ws/RemoveUserAction.java | 4 ++-- .../java/org/sonar/server/usergroups/ws/SearchAction.java | 7 +++++-- .../java/org/sonar/server/usergroups/ws/UpdateAction.java | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/AddUserAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/AddUserAction.java index b3f65f8901f..b5028c67b46 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/AddUserAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/AddUserAction.java @@ -35,13 +35,13 @@ import org.sonar.server.user.UserSession; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; +import static org.sonar.server.exceptions.NotFoundException.checkFound; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_ID; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_NAME; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_LOGIN; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_ORGANIZATION_KEY; import static org.sonar.server.usergroups.ws.GroupWsSupport.defineGroupWsParameters; import static org.sonar.server.usergroups.ws.GroupWsSupport.defineLoginWsParameter; -import static org.sonar.server.exceptions.NotFoundException.checkFound; public class AddUserAction implements UserGroupsWsAction { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java index 6123b4f9bb2..c60a1262c23 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java @@ -36,9 +36,9 @@ import org.sonarqube.ws.UserGroups; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Optional.ofNullable; +import static org.sonar.server.exceptions.BadRequestException.checkRequest; import static org.sonar.server.exceptions.NotFoundException.checkFound; import static org.sonar.server.exceptions.NotFoundException.checkFoundWithOptional; -import static org.sonar.server.exceptions.BadRequestException.checkRequest; /** * Factorizes code about user groups between web services @@ -162,6 +162,7 @@ public class GroupWsSupport { private static void defineGroupIdWsParameter(WebService.NewAction action) { action.createParam(PARAM_GROUP_ID) + .setDeprecatedSince("8.3") .setDescription("Group id") .setExampleValue("42"); } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java index bd7994cfdb9..e201e718161 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java @@ -31,13 +31,13 @@ import org.sonar.db.user.UserDto; import org.sonar.server.user.UserSession; import static java.lang.String.format; +import static org.sonar.server.exceptions.BadRequestException.checkRequest; +import static org.sonar.server.exceptions.NotFoundException.checkFound; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_ID; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_NAME; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_LOGIN; import static org.sonar.server.usergroups.ws.GroupWsSupport.defineGroupWsParameters; import static org.sonar.server.usergroups.ws.GroupWsSupport.defineLoginWsParameter; -import static org.sonar.server.exceptions.NotFoundException.checkFound; -import static org.sonar.server.exceptions.BadRequestException.checkRequest; public class RemoveUserAction implements UserGroupsWsAction { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java index ff1277f4158..b3828aea235 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/SearchAction.java @@ -45,6 +45,7 @@ import static org.apache.commons.lang.StringUtils.defaultIfBlank; import static org.sonar.api.utils.Paging.forPageIndex; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; import static org.sonar.server.es.SearchOptions.MAX_LIMIT; +import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_ID; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_ORGANIZATION_KEY; import static org.sonar.server.ws.WsUtils.writeProtobuf; import static org.sonarqube.ws.UserGroups.Group; @@ -80,8 +81,10 @@ public class SearchAction implements UserGroupsWsAction { .addFieldsParam(ALL_FIELDS) .addPagingParams(100, MAX_LIMIT) .addSearchQuery("sonar-users", "names") - .setChangelog(new Change("6.4", "Paging response fields moved to a Paging object"), - new Change("6.4", "'default' response field has been added")); + .setChangelog( + new Change("6.4", "Paging response fields moved to a Paging object"), + new Change("6.4", "'default' response field has been added"), + new Change("8.3", "field " + PARAM_GROUP_ID + "in the response is deprecated")); action.createParam(PARAM_ORGANIZATION_KEY) .setDescription("Key of organization. If not set then groups are searched in default organization.") diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java index 555439dcd9d..7303552ab38 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/UpdateAction.java @@ -37,13 +37,13 @@ import org.sonarqube.ws.UserGroups; import static java.lang.String.format; import static org.sonar.api.user.UserGroupValidation.GROUP_NAME_MAX_LENGTH; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; +import static org.sonar.server.exceptions.NotFoundException.checkFound; +import static org.sonar.server.exceptions.NotFoundException.checkFoundWithOptional; import static org.sonar.server.usergroups.ws.GroupWsSupport.DESCRIPTION_MAX_LENGTH; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_DESCRIPTION; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_ID; import static org.sonar.server.usergroups.ws.GroupWsSupport.PARAM_GROUP_NAME; import static org.sonar.server.usergroups.ws.GroupWsSupport.toProtobuf; -import static org.sonar.server.exceptions.NotFoundException.checkFound; -import static org.sonar.server.exceptions.NotFoundException.checkFoundWithOptional; import static org.sonar.server.ws.WsUtils.writeProtobuf; public class UpdateAction implements UserGroupsWsAction { -- 2.39.5