diff options
author | Erik Johnston <erik@matrix.org> | 2019-01-25 18:31:41 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-01-25 18:31:41 +0000 |
commit | ae2a957dbacc38f1126e2eca160f17322c710d26 (patch) | |
tree | ac1a5a65f1468214cc7e03a1e6a489f20ba65a74 /synapse/api | |
parent | Merge pull request #4470 from matrix-org/erikj/require_format_version (diff) | |
download | synapse-ae2a957dbacc38f1126e2eca160f17322c710d26.tar.xz |
Pass through room version to event auth
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/auth.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index e37b807c94..7b213e54c8 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -65,7 +65,7 @@ class Auth(object): register_cache("cache", "token_cache", self.token_cache) @defer.inlineCallbacks - def check_from_context(self, event, context, do_sig_check=True): + def check_from_context(self, room_version, event, context, do_sig_check=True): prev_state_ids = yield context.get_prev_state_ids(self.store) auth_events_ids = yield self.compute_auth_events( event, prev_state_ids, for_verification=True, @@ -74,12 +74,16 @@ class Auth(object): auth_events = { (e.type, e.state_key): e for e in itervalues(auth_events) } - self.check(event, auth_events=auth_events, do_sig_check=do_sig_check) + self.check( + room_version, event, + auth_events=auth_events, do_sig_check=do_sig_check, + ) - def check(self, event, auth_events, do_sig_check=True): + def check(self, room_version, event, auth_events, do_sig_check=True): """ Checks if this event is correctly authed. Args: + room_version (str): version of the room event: the event being checked. auth_events (dict: event-key -> event): the existing room state. @@ -88,7 +92,9 @@ class Auth(object): True if the auth checks pass. """ with Measure(self.clock, "auth.check"): - event_auth.check(event, auth_events, do_sig_check=do_sig_check) + event_auth.check( + room_version, event, auth_events, do_sig_check=do_sig_check + ) @defer.inlineCallbacks def check_joined_room(self, room_id, user_id, current_state=None): |