add some accessors to Ar for common patterns

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-10-24 12:03:56 +00:00
parent 60cc07134f
commit ee92a33a4d
17 changed files with 109 additions and 147 deletions

View file

@ -18,13 +18,11 @@ pub(crate) async fn create_invite_route(
State(services): State<crate::State>, InsecureClientIp(client): InsecureClientIp,
body: Ruma<create_invite::v2::Request>,
) -> Result<create_invite::v2::Response> {
let origin = body.origin.as_ref().expect("server is authenticated");
// ACL check origin
services
.rooms
.event_handler
.acl_check(origin, &body.room_id)
.acl_check(body.origin(), &body.room_id)
.await?;
if !services
@ -55,10 +53,11 @@ pub(crate) async fn create_invite_route(
.globals
.config
.forbidden_remote_server_names
.contains(origin)
.contains(body.origin())
{
warn!(
"Received federated/remote invite from banned server {origin} for room ID {}. Rejecting.",
"Received federated/remote invite from banned server {} for room ID {}. Rejecting.",
body.origin(),
body.room_id
);