summary refs log tree commit diff
path: root/synapse/rest/room.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-09-03 17:46:37 +0100
committerErik Johnston <erik@matrix.org>2014-09-03 17:46:52 +0100
commit1b491e50c9ea7bd389d558c89b30540b386dcea5 (patch)
tree3de094cf7e46124a0bdddd4e6c475a6c2e150d9d /synapse/rest/room.py
parentUnindent list in specification to remove blockquote (diff)
downloadsynapse-1b491e50c9ea7bd389d558c89b30540b386dcea5.tar.xz
Implement a kick api
Diffstat (limited to '')
-rw-r--r--synapse/rest/room.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/rest/room.py b/synapse/rest/room.py
index 37b6b8cbc6..308b447090 100644
--- a/synapse/rest/room.py
+++ b/synapse/rest/room.py
@@ -388,7 +388,7 @@ class RoomMembershipRestServlet(RestServlet):
     def register(self, http_server):
         # /rooms/$roomid/[invite|join|leave]
         PATTERN = ("/rooms/(?P<room_id>[^/]*)/" +
-            "(?P<membership_action>join|invite|leave|ban)")
+            "(?P<membership_action>join|invite|leave|ban|kick)")
         register_txn_path(self, PATTERN, http_server)
 
     @defer.inlineCallbacks
@@ -399,11 +399,14 @@ class RoomMembershipRestServlet(RestServlet):
 
         # target user is you unless it is an invite
         state_key = user.to_string()
-        if membership_action in ["invite", "ban"]:
+        if membership_action in ["invite", "ban", "kick"]:
             if "user_id" not in content:
                 raise SynapseError(400, "Missing user_id key.")
             state_key = content["user_id"]
 
+            if membership_action == "kick":
+                membership_action = "leave"
+
         event = self.event_factory.create_event(
             etype=RoomMemberEvent.TYPE,
             content={"membership": unicode(membership_action)},