diff options
author | Matthew Hodgson <matthew@arasphere.net> | 2018-06-26 10:43:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-26 10:43:14 +0100 |
commit | c7f6b420aeba24e9a216d7a013a1f313637c56e5 (patch) | |
tree | cc629ff957ac7fcc5d0997650467881f1add0a74 /synapse/rest/client/v1/admin.py | |
parent | Merge pull request #3438 from turt2live/travis/dont-print-access-tokens-in-logs (diff) | |
parent | update doc for deactivate API (diff) | |
download | synapse-c7f6b420aeba24e9a216d7a013a1f313637c56e5.tar.xz |
Merge pull request #3448 from matrix-org/matthew/gdpr-deactivate-admin-api
add GDPR erase param to deactivate API
Diffstat (limited to 'synapse/rest/client/v1/admin.py')
-rw-r--r-- | synapse/rest/client/v1/admin.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/admin.py b/synapse/rest/client/v1/admin.py index ddaedb2a8c..8fb08dc526 100644 --- a/synapse/rest/client/v1/admin.py +++ b/synapse/rest/client/v1/admin.py @@ -16,6 +16,8 @@ from twisted.internet import defer +from six.moves import http_client + from synapse.api.constants import Membership from synapse.api.errors import AuthError, SynapseError, Codes, NotFoundError from synapse.types import UserID, create_requester @@ -247,6 +249,15 @@ class DeactivateAccountRestServlet(ClientV1RestServlet): @defer.inlineCallbacks def on_POST(self, request, target_user_id): + body = parse_json_object_from_request(request, allow_empty_body=True) + erase = body.get("erase", False) + if not isinstance(erase, bool): + raise SynapseError( + http_client.BAD_REQUEST, + "Param 'erase' must be a boolean, if given", + Codes.BAD_JSON, + ) + UserID.from_string(target_user_id) requester = yield self.auth.get_user_by_req(request) is_admin = yield self.auth.is_server_admin(requester.user) @@ -255,7 +266,7 @@ class DeactivateAccountRestServlet(ClientV1RestServlet): raise AuthError(403, "You are not a server admin") yield self._deactivate_account_handler.deactivate_account( - target_user_id, False, + target_user_id, erase, ) defer.returnValue((200, {})) |