From e146c752790efe34f05d2803a753718a70a3fc3b Mon Sep 17 00:00:00 2001 From: strawberry Date: Sat, 14 Sep 2024 12:27:22 -0400 Subject: [PATCH] dont include appservices in room guest access enforcement check Signed-off-by: strawberry --- src/admin/user/commands.rs | 3 ++- src/api/client/account.rs | 1 + src/api/client/membership.rs | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/admin/user/commands.rs b/src/admin/user/commands.rs index cb571d77..551ce20b 100644 --- a/src/admin/user/commands.rs +++ b/src/admin/user/commands.rs @@ -111,6 +111,7 @@ pub(super) async fn create_user(&self, username: String, password: Option, ) -> Result { let sender_user = body.sender_user.as_deref().expect("user is authenticated"); + let appservice_info = &body.appservice_info; let body = body.body; let (servers, room_id) = match OwnedRoomId::try_from(body.room_id_or_alias) { @@ -312,6 +314,7 @@ pub(crate) async fn join_room_by_id_or_alias_route( body.reason.clone(), &servers, body.third_party_signed.as_ref(), + appservice_info, ) .await?; @@ -662,11 +665,11 @@ pub(crate) async fn joined_members_route( pub async fn join_room_by_id_helper( services: &Services, sender_user: &UserId, room_id: &RoomId, reason: Option, servers: &[OwnedServerName], - third_party_signed: Option<&ThirdPartySigned>, + third_party_signed: Option<&ThirdPartySigned>, appservice_info: &Option, ) -> Result { let state_lock = services.rooms.state.mutex.lock(room_id).await; - let user_is_guest = services.users.is_deactivated(sender_user).unwrap_or(false); + let user_is_guest = services.users.is_deactivated(sender_user).unwrap_or(false) && appservice_info.is_none(); if matches!(services.rooms.state_accessor.guest_can_join(room_id), Ok(false)) && user_is_guest { return Err!(Request(Forbidden("Guests are not allowed to join this room")));