diff options
author | Richard van der Hoff <richard@matrix.org> | 2017-11-01 10:29:34 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2017-11-01 15:46:22 +0000 |
commit | dd13310fb8ca0cfce60e4fccdb93e90a16078609 (patch) | |
tree | f6b42e32e82bb54fd6027c2985dd09c96b7a2ac9 /synapse/rest/client/v1/admin.py | |
parent | Merge pull request #2610 from matrix-org/rav/schema_for_pw_providers (diff) | |
download | synapse-dd13310fb8ca0cfce60e4fccdb93e90a16078609.tar.xz |
Move access token deletion into auth handler
Also move duplicated deactivation code into the auth handler. I want to add some hooks when we deactivate an access token, so let's bring it all in here so that there's somewhere to put it.
Diffstat (limited to 'synapse/rest/client/v1/admin.py')
-rw-r--r-- | synapse/rest/client/v1/admin.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/synapse/rest/client/v1/admin.py b/synapse/rest/client/v1/admin.py index 465b25033d..1197158fdc 100644 --- a/synapse/rest/client/v1/admin.py +++ b/synapse/rest/client/v1/admin.py @@ -137,7 +137,7 @@ class DeactivateAccountRestServlet(ClientV1RestServlet): PATTERNS = client_path_patterns("/admin/deactivate/(?P<target_user_id>[^/]*)") def __init__(self, hs): - self.store = hs.get_datastore() + self._auth_handler = hs.get_auth_handler() super(DeactivateAccountRestServlet, self).__init__(hs) @defer.inlineCallbacks @@ -149,12 +149,7 @@ class DeactivateAccountRestServlet(ClientV1RestServlet): if not is_admin: raise AuthError(403, "You are not a server admin") - # FIXME: Theoretically there is a race here wherein user resets password - # using threepid. - yield self.store.user_delete_access_tokens(target_user_id) - yield self.store.user_delete_threepids(target_user_id) - yield self.store.user_set_password_hash(target_user_id, None) - + yield self._auth_handler.deactivate_account(target_user_id) defer.returnValue((200, {})) |