diff options
author | Erik Johnston <erik@matrix.org> | 2016-07-05 10:28:51 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-07-05 10:28:51 +0100 |
commit | 2d21d43c34751cffb5f324bd58ceff060f65f679 (patch) | |
tree | f94af9ec9b706479284c3fe3842fed5f64650fdd /synapse/rest/client | |
parent | Add storage function to purge history for a room (diff) | |
download | synapse-2d21d43c34751cffb5f324bd58ceff060f65f679.tar.xz |
Add purge_history API
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v1/admin.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/admin.py b/synapse/rest/client/v1/admin.py index e54c472e08..71537a7d0b 100644 --- a/synapse/rest/client/v1/admin.py +++ b/synapse/rest/client/v1/admin.py @@ -77,6 +77,24 @@ class PurgeMediaCacheRestServlet(ClientV1RestServlet): defer.returnValue((200, ret)) +class PurgeHistoryRestServlet(ClientV1RestServlet): + PATTERNS = client_path_patterns( + "/admin/purge_history/(?P<room_id>[^/]*)/(?P<event_id>[^/]*)" + ) + + @defer.inlineCallbacks + def on_POST(self, request, room_id, event_id): + requester = yield self.auth.get_user_by_req(request) + is_admin = yield self.auth.is_server_admin(requester.user) + + if not is_admin: + raise AuthError(403, "You are not a server admin") + + yield self.handlers.message_handler.purge_history(room_id, event_id) + + defer.returnValue((200, {})) + + class DeactivateAccountRestServlet(ClientV1RestServlet): PATTERNS = client_path_patterns("/admin/deactivate/(?P<target_user_id>[^/]*)") |