summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorlugino-emeritus <lugino-emeritus@users.noreply.github.com>2020-07-28 14:41:44 +0200
committerGitHub <noreply@github.com>2020-07-28 13:41:44 +0100
commit3857de2194e3b2057c4af71e095eb6759508f25f (patch)
tree3acf01753d0132a93955218e37c87d259bd9a59c /synapse/handlers
parentMerge tag 'v1.18.0rc2' into develop (diff)
downloadsynapse-3857de2194e3b2057c4af71e095eb6759508f25f.tar.xz
Option to allow server admins to join complex rooms (#7902)
Fixes #7901.

Signed-off-by: Niklas Tittjung <nik_t.01@web.de>
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room_member.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index a1a8fa1d3b..5a40e8c144 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -952,7 +952,11 @@ class RoomMemberMasterHandler(RoomMemberHandler):
         if len(remote_room_hosts) == 0:
             raise SynapseError(404, "No known servers")
 
-        if self.hs.config.limit_remote_rooms.enabled:
+        check_complexity = self.hs.config.limit_remote_rooms.enabled
+        if check_complexity and self.hs.config.limit_remote_rooms.admins_can_join:
+            check_complexity = not await self.hs.auth.is_server_admin(user)
+
+        if check_complexity:
             # Fetch the room complexity
             too_complex = await self._is_remote_room_too_complex(
                 room_id, remote_room_hosts
@@ -975,7 +979,7 @@ class RoomMemberMasterHandler(RoomMemberHandler):
 
         # Check the room we just joined wasn't too large, if we didn't fetch the
         # complexity of it before.
-        if self.hs.config.limit_remote_rooms.enabled:
+        if check_complexity:
             if too_complex is False:
                 # We checked, and we're under the limit.
                 return event_id, stream_id