mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 00:09:26 -05:00
Merge pull request #133 from matrix-org/invite_power_level
Invite power level
This commit is contained in:
commit
55fcf62e9c
@ -222,6 +222,13 @@ class Auth(object):
|
|||||||
elif target_in_room: # the target is already in the room.
|
elif target_in_room: # the target is already in the room.
|
||||||
raise AuthError(403, "%s is already in the room." %
|
raise AuthError(403, "%s is already in the room." %
|
||||||
target_user_id)
|
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:
|
elif Membership.JOIN == membership:
|
||||||
# Joins are valid iff caller == target and they were:
|
# Joins are valid iff caller == target and they were:
|
||||||
# invited: They are accepting the invitation
|
# invited: They are accepting the invitation
|
||||||
@ -561,6 +568,7 @@ class Auth(object):
|
|||||||
("ban", []),
|
("ban", []),
|
||||||
("redact", []),
|
("redact", []),
|
||||||
("kick", []),
|
("kick", []),
|
||||||
|
("invite", []),
|
||||||
]
|
]
|
||||||
|
|
||||||
old_list = current_state.content.get("users")
|
old_list = current_state.content.get("users")
|
||||||
|
@ -213,7 +213,8 @@ class RoomCreationHandler(BaseHandler):
|
|||||||
"state_default": 50,
|
"state_default": 50,
|
||||||
"ban": 50,
|
"ban": 50,
|
||||||
"kick": 50,
|
"kick": 50,
|
||||||
"redact": 50
|
"redact": 50,
|
||||||
|
"invite": 0,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user