@@ -804,7 +804,7 @@ async def on_make_join_request(
804804 )
805805
806806 # now check that we are *still* in the room
807- is_in_room = await self ._event_auth_handler .check_host_in_room (
807+ is_in_room = await self ._event_auth_handler .is_host_in_room (
808808 room_id , self .server_name
809809 )
810810 if not is_in_room :
@@ -1150,9 +1150,7 @@ async def get_state_ids_for_pdu(self, room_id: str, event_id: str) -> List[str]:
11501150 async def on_backfill_request (
11511151 self , origin : str , room_id : str , pdu_list : List [str ], limit : int
11521152 ) -> List [EventBase ]:
1153- in_room = await self ._event_auth_handler .check_host_in_room (room_id , origin )
1154- if not in_room :
1155- raise AuthError (403 , "Host not in room." )
1153+ await self ._event_auth_handler .assert_host_in_room (room_id , origin )
11561154
11571155 # Synapse asks for 100 events per backfill request. Do not allow more.
11581156 limit = min (limit , 100 )
@@ -1198,21 +1196,17 @@ async def get_persisted_pdu(
11981196 event_id , allow_none = True , allow_rejected = True
11991197 )
12001198
1201- if event :
1202- in_room = await self ._event_auth_handler .check_host_in_room (
1203- event .room_id , origin
1204- )
1205- if not in_room :
1206- raise AuthError (403 , "Host not in room." )
1207-
1208- events = await filter_events_for_server (
1209- self ._storage_controllers , origin , [event ]
1210- )
1211- event = events [0 ]
1212- return event
1213- else :
1199+ if not event :
12141200 return None
12151201
1202+ await self ._event_auth_handler .assert_host_in_room (event .room_id , origin )
1203+
1204+ events = await filter_events_for_server (
1205+ self ._storage_controllers , origin , [event ]
1206+ )
1207+ event = events [0 ]
1208+ return event
1209+
12161210 async def on_get_missing_events (
12171211 self ,
12181212 origin : str ,
@@ -1221,9 +1215,7 @@ async def on_get_missing_events(
12211215 latest_events : List [str ],
12221216 limit : int ,
12231217 ) -> List [EventBase ]:
1224- in_room = await self ._event_auth_handler .check_host_in_room (room_id , origin )
1225- if not in_room :
1226- raise AuthError (403 , "Host not in room." )
1218+ await self ._event_auth_handler .assert_host_in_room (room_id , origin )
12271219
12281220 # Only allow up to 20 events to be retrieved per request.
12291221 limit = min (limit , 20 )
@@ -1257,7 +1249,7 @@ async def exchange_third_party_invite(
12571249 "state_key" : target_user_id ,
12581250 }
12591251
1260- if await self ._event_auth_handler .check_host_in_room (room_id , self .hs .hostname ):
1252+ if await self ._event_auth_handler .is_host_in_room (room_id , self .hs .hostname ):
12611253 room_version_obj = await self .store .get_room_version (room_id )
12621254 builder = self .event_builder_factory .for_room_version (
12631255 room_version_obj , event_dict
0 commit comments