From 6322759968b6f1b40294c486e26bab35a00bc9bd Mon Sep 17 00:00:00 2001 From: dklimpel <5740567+dklimpel@users.noreply.github.com> Date: Fri, 12 Feb 2021 22:51:17 +0100 Subject: [PATCH 1/5] Remove old admin API `GET /_synapse/admin/v1/users/` --- synapse/rest/admin/__init__.py | 2 -- synapse/rest/admin/users.py | 21 --------------------- 2 files changed, 23 deletions(-) diff --git a/synapse/rest/admin/__init__.py b/synapse/rest/admin/__init__.py index 8457db1e2275..5daa795df1a4 100644 --- a/synapse/rest/admin/__init__.py +++ b/synapse/rest/admin/__init__.py @@ -62,7 +62,6 @@ UserMembershipRestServlet, UserRegisterServlet, UserRestServletV2, - UsersRestServlet, UsersRestServletV2, UserTokenRestServlet, WhoisRestServlet, @@ -248,7 +247,6 @@ def register_servlets_for_client_rest_resource(hs, http_server): PurgeHistoryStatusRestServlet(hs).register(http_server) DeactivateAccountRestServlet(hs).register(http_server) PurgeHistoryRestServlet(hs).register(http_server) - UsersRestServlet(hs).register(http_server) ResetPasswordRestServlet(hs).register(http_server) SearchUsersRestServlet(hs).register(http_server) ShutdownRoomRestServlet(hs).register(http_server) diff --git a/synapse/rest/admin/users.py b/synapse/rest/admin/users.py index 9350c704b981..c055f779de88 100644 --- a/synapse/rest/admin/users.py +++ b/synapse/rest/admin/users.py @@ -43,27 +43,6 @@ logger = logging.getLogger(__name__) -class UsersRestServlet(RestServlet): - PATTERNS = admin_patterns("/users/(?P[^/]*)$") - - def __init__(self, hs): - self.hs = hs - self.store = hs.get_datastore() - self.auth = hs.get_auth() - self.admin_handler = hs.get_admin_handler() - - async def on_GET(self, request, user_id): - target_user = UserID.from_string(user_id) - await assert_requester_is_admin(self.auth, request) - - if not self.hs.is_mine(target_user): - raise SynapseError(400, "Can only users a local user") - - ret = await self.store.get_users() - - return 200, ret - - class UsersRestServletV2(RestServlet): PATTERNS = admin_patterns("/users$", "v2") From c9604ab2b57262e4c9e47b5d0eef058d6ee4a8d4 Mon Sep 17 00:00:00 2001 From: dklimpel <5740567+dklimpel@users.noreply.github.com> Date: Fri, 12 Feb 2021 23:13:43 +0100 Subject: [PATCH 2/5] changelog --- changelog.d/9401.removal | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/9401.removal diff --git a/changelog.d/9401.removal b/changelog.d/9401.removal new file mode 100644 index 000000000000..9c813e021574 --- /dev/null +++ b/changelog.d/9401.removal @@ -0,0 +1 @@ +Remove old admin API `GET /_synapse/admin/v1/users/`. \ No newline at end of file From 05dce7cdb098736f24361af1d1ee54b264e21242 Mon Sep 17 00:00:00 2001 From: dklimpel <5740567+dklimpel@users.noreply.github.com> Date: Fri, 12 Feb 2021 23:46:13 +0100 Subject: [PATCH 3/5] fix ClientIpAuthTestCase --- tests/storage/test_client_ips.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/storage/test_client_ips.py b/tests/storage/test_client_ips.py index a69117c5a9fa..35e3ddfe0737 100644 --- a/tests/storage/test_client_ips.py +++ b/tests/storage/test_client_ips.py @@ -372,7 +372,7 @@ def test_old_user_ips_pruned(self): class ClientIpAuthTestCase(unittest.HomeserverTestCase): servlets = [ - synapse.rest.admin.register_servlets_for_client_rest_resource, + synapse.rest.admin.register_servlets, login.register_servlets, ] @@ -416,7 +416,7 @@ def _runtest(self, headers, expected_ip, make_request_args): self.reactor, self.site, "GET", - "/_synapse/admin/v1/users/" + self.user_id, + "/_synapse/admin/v2/users/" + self.user_id, access_token=access_token, custom_headers=headers1.items(), **make_request_args, From 258659e766e012b6b7041362e7426213b4140298 Mon Sep 17 00:00:00 2001 From: dklimpel <5740567+dklimpel@users.noreply.github.com> Date: Wed, 17 Feb 2021 21:21:02 +0100 Subject: [PATCH 4/5] add upgrade information --- UPGRADE.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/UPGRADE.rst b/UPGRADE.rst index 22edfe0d6044..57094ffce50f 100644 --- a/UPGRADE.rst +++ b/UPGRADE.rst @@ -85,6 +85,22 @@ for example: wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb +Upgrading to v1.xx.0 +==================== + +Removal old List Accounts Admin API +----------------------------------- + +Remove old List Accounts Admin API: + +* ``GET /_synapse/admin/v1/users/`` + +The new `List Accounts Admin API `_ +is accessible under ``GET /_synapse/admin/v2/users``. +The new API is available since Synapse 1.7.0 (2019-12-13). + +The deprecation of the old endpoints was announced with Synapse 1.xx.0 (released on 2021-xx-xx). + Upgrading to v1.27.0 ==================== From 5e608d69d52f7a40d841bd6b873d9a6e4c4ab92a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 9 Apr 2021 09:29:33 +0100 Subject: [PATCH 5/5] Update UPGRADE.rst --- UPGRADE.rst | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/UPGRADE.rst b/UPGRADE.rst index 998b82899044..665821d4ef04 100644 --- a/UPGRADE.rst +++ b/UPGRADE.rst @@ -88,18 +88,15 @@ for example: Upgrading to v1.32.0 ==================== -Removal old List Accounts Admin API ------------------------------------ - -Remove old List Accounts Admin API: +Removal of old List Accounts Admin API +-------------------------------------- -* ``GET /_synapse/admin/v1/users/`` +The deprecated v1 "list accounts" admin API (``GET /_synapse/admin/v1/users/``) has been removed in this version. -The new `List Accounts Admin API `_ -is accessible under ``GET /_synapse/admin/v2/users``. -The new API is available since Synapse 1.7.0 (2019-12-13). +The `v2 list accounts API `_ +has been available since Synapse 1.7.0 (2019-12-13), and is accessible under ``GET /_synapse/admin/v2/users``. -The deprecation of the old endpoints was announced with Synapse 1.28.0 (released on 2021-02-25). +The deprecation of the old endpoint was announced with Synapse 1.28.0 (released on 2021-02-25). Upgrading to v1.29.0 ====================