mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 00:23:51 +01:00
Fix invite auth
This commit is contained in:
parent
6cb6cb9e69
commit
407d8a5019
1 changed files with 5 additions and 3 deletions
|
@ -128,13 +128,14 @@ class Auth(object):
|
|||
key = (RoomMemberEvent.TYPE, event.user_id, )
|
||||
caller = event.old_state_events.get(key)
|
||||
|
||||
caller_in_room = caller and caller.membership == "join"
|
||||
caller_in_room = caller and caller.membership == Membership.JOIN
|
||||
caller_invited = caller and caller.membership == Membership.INVITE
|
||||
|
||||
# get info about the target
|
||||
key = (RoomMemberEvent.TYPE, target_user_id, )
|
||||
target = event.old_state_events.get(key)
|
||||
|
||||
target_in_room = target and target.membership == "join"
|
||||
target_in_room = target and target.membership == Membership.JOIN
|
||||
|
||||
membership = event.content["membership"]
|
||||
|
||||
|
@ -162,6 +163,7 @@ class Auth(object):
|
|||
"is_membership_change_allowed: %s",
|
||||
{
|
||||
"caller_in_room": caller_in_room,
|
||||
"caller_invited": caller_invited,
|
||||
"target_in_room": target_in_room,
|
||||
"membership": membership,
|
||||
"join_rule": join_rule,
|
||||
|
@ -189,7 +191,7 @@ class Auth(object):
|
|||
elif join_rule == JoinRules.PUBLIC:
|
||||
pass
|
||||
elif join_rule == JoinRules.INVITE:
|
||||
if not caller_in_room:
|
||||
if not caller_in_room and not caller_invited:
|
||||
raise AuthError(403, "You are not invited to this room.")
|
||||
else:
|
||||
# TODO (erikj): may_join list
|
||||
|
|
Loading…
Reference in a new issue