Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Remove old admin API GET /_synapse/admin/v1/users/<user_id> #9401

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/9401.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove old admin API `GET /_synapse/admin/v1/users/<user_id>`.
2 changes: 0 additions & 2 deletions synapse/rest/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
UserMembershipRestServlet,
UserRegisterServlet,
UserRestServletV2,
UsersRestServlet,
UsersRestServletV2,
UserTokenRestServlet,
WhoisRestServlet,
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 0 additions & 21 deletions synapse/rest/admin/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,6 @@
logger = logging.getLogger(__name__)


class UsersRestServlet(RestServlet):
PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)$")

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")

Expand Down
4 changes: 2 additions & 2 deletions tests/storage/test_client_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]

Expand Down Expand Up @@ -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,
Expand Down