From 3ade4c621ed874e2d2c6c9b12c6dd303350639c4 Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Thu, 4 Jul 2024 12:01:11 +0200 Subject: [PATCH] Ignore rules if the invited user is in the bypass list or an admin (#7) --- room_access_rules/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/room_access_rules/__init__.py b/room_access_rules/__init__.py index a7b0da5..b8da083 100644 --- a/room_access_rules/__init__.py +++ b/room_access_rules/__init__.py @@ -673,6 +673,14 @@ async def _on_membership_or_invite( if await self._user_can_bypass_rules(previous_membership.sender): return True + # Let's ignore rules if the invited user is in the bypass list or an admin + if ( + event.type == EventTypes.Member + and event.membership == Membership.INVITE + and await self._user_can_bypass_rules(event.state_key) + ): + return True + if rule == AccessRules.RESTRICTED: ret = self._on_membership_or_invite_restricted(event) elif rule == AccessRules.UNRESTRICTED: