summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-04-28 10:50:34 +0100
committerMark Haines <mjark@negativecurvature.net>2015-04-28 10:50:34 +0100
commit55fcf62e9cef9ef90dfdfc9f2fe3f6a6786780b8 (patch)
tree8b5df57f916e282bc618369996c8ddf67cfa33f1 /synapse
parentMerge pull request #130 from matrix-org/server_rename_check (diff)
parentMerge branch 'develop' into invite_power_level (diff)
downloadsynapse-55fcf62e9cef9ef90dfdfc9f2fe3f6a6786780b8.tar.xz
Merge pull request #133 from matrix-org/invite_power_level
Invite power level
Diffstat (limited to 'synapse')
-rw-r--r--synapse/api/auth.py8
-rw-r--r--synapse/handlers/room.py3
2 files changed, 10 insertions, 1 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index a21120b313..935dffbabe 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -222,6 +222,13 @@ class Auth(object):
             elif target_in_room:  # the target is already in the room.
                 raise AuthError(403, "%s is already in the room." %
                                      target_user_id)
+            else:
+                invite_level = self._get_named_level(auth_events, "invite", 0)
+
+                if user_level < invite_level:
+                    raise AuthError(
+                        403, "You cannot invite user %s." % target_user_id
+                    )
         elif Membership.JOIN == membership:
             # Joins are valid iff caller == target and they were:
             # invited: They are accepting the invitation
@@ -561,6 +568,7 @@ class Auth(object):
             ("ban", []),
             ("redact", []),
             ("kick", []),
+            ("invite", []),
         ]
 
         old_list = current_state.content.get("users")
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index f9fc4a9c98..1226b23bc7 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -213,7 +213,8 @@ class RoomCreationHandler(BaseHandler):
                 "state_default": 50,
                 "ban": 50,
                 "kick": 50,
-                "redact": 50
+                "redact": 50,
+                "invite": 0,
             },
         )