Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #814 from matrix-org/matthew/3pid_invite_auth
Browse files Browse the repository at this point in the history
special case m.room.third_party_invite event auth to match invites,
  • Loading branch information
ara4n committed Jun 2, 2016
2 parents f84b89f + aaa70e2 commit c5af1b6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions synapse/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ def check(self, event, auth_events):
return allowed

self.check_event_sender_in_room(event, auth_events)

# Special case to allow m.room.third_party_invite events wherever
# a user is allowed to issue invites. Fixes
# https://github.com/vector-im/vector-web/issues/1208 hopefully
if event.type == EventTypes.ThirdPartyInvite:
user_level = self._get_user_power_level(event.user_id, auth_events)
invite_level = self._get_named_level(auth_events, "invite", 0)

if user_level < invite_level:
raise AuthError(
403, (
"You cannot issue a third party invite for %s." %
(event.content.display_name,)
)
)
else:
return True

self._can_send_event(event, auth_events)

if event.type == EventTypes.PowerLevels:
Expand Down

0 comments on commit c5af1b6

Please sign in to comment.