From 3849b7a0919e938cf16167fd738ca98a24e81fc4 Mon Sep 17 00:00:00 2001 From: Aurelien Poscia Date: Tue, 16 Jan 2024 14:48:21 +0100 Subject: [PATCH] SONAR-21114 deprecate migrated Groups api v1 endpoints --- .../java/org/sonar/server/usergroups/ws/AddUserActionIT.java | 1 + .../java/org/sonar/server/usergroups/ws/CreateActionIT.java | 1 + .../java/org/sonar/server/usergroups/ws/DeleteActionIT.java | 1 + .../org/sonar/server/usergroups/ws/RemoveUserActionIT.java | 1 + .../java/org/sonar/server/usergroups/ws/SearchActionIT.java | 1 + .../it/java/org/sonar/server/usergroups/ws/UsersActionIT.java | 1 + .../src/main/java/org/sonar/server/user/ws/CreateAction.java | 4 ++-- .../java/org/sonar/server/usergroups/ws/CreateAction.java | 2 ++ .../java/org/sonar/server/usergroups/ws/DeleteAction.java | 2 ++ .../java/org/sonar/server/usergroups/ws/SearchAction.java | 2 ++ .../java/org/sonar/server/usergroups/ws/UpdateAction.java | 2 ++ 11 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/AddUserActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/AddUserActionIT.java index de20310368d..8d7da49391c 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/AddUserActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/AddUserActionIT.java @@ -71,6 +71,7 @@ public class AddUserActionIT { assertThat(wsDef.since()).isEqualTo("5.2"); assertThat(wsDef.isPost()).isTrue(); assertThat(wsDef.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly( + tuple("10.4", "Deprecated. Use POST /api/v2/authorizations/group-memberships instead"), tuple("10.0", "Parameter 'id' is removed. Use 'name' instead."), tuple("8.4", "Parameter 'id' is deprecated. Format changes from integer to string. Use 'name' instead.")); } diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java index e3a4bdcae7e..410f6a39aca 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/CreateActionIT.java @@ -73,6 +73,7 @@ public class CreateActionIT { assertThat(action.responseExampleAsString()).isNotEmpty(); assertThat(action.params()).hasSize(2); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly( + tuple("10.4", "Deprecated. Use POST /api/v2/authorizations/groups instead"), tuple("8.4", "Field 'id' format in the response changes from integer to string.")); } diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java index 3616271390a..c91c167a7c9 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/DeleteActionIT.java @@ -78,6 +78,7 @@ public class DeleteActionIT { assertThat(wsDef.since()).isEqualTo("5.2"); assertThat(wsDef.isPost()).isTrue(); assertThat(wsDef.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly( + tuple("10.4", "Deprecated. Use DELETE /api/v2/authorizations/groups instead"), tuple("10.0", "Parameter 'id' is removed. Use 'name' instead."), tuple("8.4", "Parameter 'id' is deprecated. Format changes from integer to string. Use 'name' instead.")); } diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/RemoveUserActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/RemoveUserActionIT.java index 20f0899bdba..a1aa16a6d12 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/RemoveUserActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/RemoveUserActionIT.java @@ -71,6 +71,7 @@ public class RemoveUserActionIT { assertThat(wsDef.since()).isEqualTo("5.2"); assertThat(wsDef.isPost()).isTrue(); assertThat(wsDef.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly( + tuple("10.4", "Deprecated. Use DELETE /api/v2/authorizations/group-memberships instead"), tuple("10.0", "Parameter 'id' is removed. Use 'name' instead."), tuple("8.4", "Parameter 'id' is deprecated. Format changes from integer to string. Use 'name' instead.")); } diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/SearchActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/SearchActionIT.java index 321a066e80e..65c5f44cc99 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/SearchActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/SearchActionIT.java @@ -85,6 +85,7 @@ public class SearchActionIT { assertThat(action.responseExampleAsString()).isNotEmpty(); assertThat(action.params()).hasSize(5); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly( + tuple("10.4", "Deprecated. Use GET /api/v2/authorizations/groups instead"), tuple("10.0", "Field 'id' in the response has been removed"), tuple("10.0", "New parameter 'managed' to optionally search by managed status"), tuple("10.0", "Response includes 'managed' field."), diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UsersActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UsersActionIT.java index e0e6ad2cd90..41982265143 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UsersActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/usergroups/ws/UsersActionIT.java @@ -71,6 +71,7 @@ public class UsersActionIT { assertThat(wsDef.since()).isEqualTo("5.2"); assertThat(wsDef.isPost()).isFalse(); assertThat(wsDef.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly( + tuple("10.4", "Deprecated. Use GET /api/v2/authorizations/group-memberships instead"), tuple("10.0", "Field 'managed' added to the payload."), tuple("10.0", "Parameter 'id' is removed. Use 'name' instead."), tuple("9.8", "response fields 'total', 's', 'ps' have been deprecated, please use 'paging' object instead."), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CreateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CreateAction.java index 14dea222731..c3f74874869 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CreateAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CreateAction.java @@ -73,13 +73,13 @@ public class CreateAction implements UsersWsAction { "Requires Administer System permission") .setSince("3.7") .setChangelog( + new Change("10.4", "Deprecated. Use POST api/v2/users-management/users instead"), new Change("6.3", "The password is only mandatory when creating local users, and should not be set on non local users"), new Change("6.3", "The 'infos' message is no more returned when a user is reactivated")) .setPost(true) .setResponseExample(getClass().getResource("create-example.json")) .setHandler(this) - .setDeprecatedSince("10.4") - .setChangelog(new Change("10.4", "Deprecated. Use POST api/v2/users-management/users instead"));; + .setDeprecatedSince("10.4"); action.createParam(PARAM_LOGIN) .setRequired(true) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java index 4036978040d..6d7f21ef097 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/CreateAction.java @@ -64,7 +64,9 @@ public class CreateAction implements UserGroupsWsAction { .setPost(true) .setResponseExample(getClass().getResource("create-example.json")) .setSince("5.2") + .setDeprecatedSince("10.4") .setChangelog( + new Change("10.4", "Deprecated. Use POST /api/v2/authorizations/groups instead"), new Change("8.4", "Field 'id' format in the response changes from integer to string.")); action.createParam(PARAM_GROUP_NAME) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java index ae74be3d510..d613daf25d8 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/DeleteAction.java @@ -61,8 +61,10 @@ public class DeleteAction implements UserGroupsWsAction { "Requires the following permission: 'Administer System'.", PARAM_GROUP_NAME)) .setHandler(this) .setSince("5.2") + .setDeprecatedSince("10.4") .setPost(true) .setChangelog( + new Change("10.4", "Deprecated. Use DELETE /api/v2/authorizations/groups instead"), new Change("10.0", "Parameter 'id' is removed. Use 'name' instead."), new Change("8.4", "Parameter 'id' is deprecated. Format changes from integer to string. Use 'name' instead.")); 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 e0e7308df99..aa4f484d388 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 @@ -77,10 +77,12 @@ public class SearchAction implements UserGroupsWsAction { .setHandler(this) .setResponseExample(getClass().getResource("search-example.json")) .setSince("5.2") + .setDeprecatedSince("10.4") .addFieldsParam(ALL_FIELDS) .addPagingParams(100, MAX_PAGE_SIZE) .addSearchQuery("sonar-users", "names") .setChangelog( + new Change("10.4", "Deprecated. Use GET /api/v2/authorizations/groups instead"), new Change("10.0", "Field 'id' in the response has been removed"), new Change("10.0", "New parameter 'managed' to optionally search by managed status"), new Change("10.0", "Response includes 'managed' field."), 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 11ccaf1d1bf..c36fe30486c 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 @@ -69,7 +69,9 @@ public class UpdateAction implements UserGroupsWsAction { .setPost(true) .setResponseExample(getClass().getResource("update.example.json")) .setSince("5.2") + .setDeprecatedSince("10.4") .setChangelog( + new Change("10.4", "Deprecated. Use PATCH /api/v2/authorizations/groups instead"), new Change("10.0", "Parameter 'id' is removed in favor of 'currentName'"), new Change("8.5", "Parameter 'id' deprecated in favor of 'currentName'"), new Change("8.4", "Parameter 'id' format changes from integer to string"), -- 2.39.5