From 0f5e09524d130fa81dee570810b16a3c9f6c19f0 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 12 Dec 2023 14:34:01 +0200 Subject: [PATCH] Don't apply alias rules to admins --- synapse/handlers/directory.py | 4 ++-- synapse/handlers/room.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py index 6fc3379b6..021584fdc 100644 --- a/synapse/handlers/directory.py +++ b/synapse/handlers/directory.py @@ -174,7 +174,7 @@ class DirectoryHandler: if not self.config.roomdirectory.is_alias_creation_allowed( user_id, room_id, room_alias_str - ): + ) and not is_admin: # Let's just return a generic message, as there may be all sorts of # reasons why we said no. TODO: Allow configurable error messages # per alias creation rule? @@ -510,7 +510,7 @@ class DirectoryHandler: if not self.config.roomdirectory.is_publishing_room_allowed( user_id, room_id, room_aliases - ): + ) and not await self.auth.is_server_admin(requester): # Let's just return a generic message, as there may be all sorts of # reasons why we said no. TODO: Allow configurable error messages # per alias creation rule? diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 2bd8e58da..04b394bbc 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -928,7 +928,7 @@ class RoomCreationHandler: room_aliases.append(room_alias.to_string()) if not self.config.roomdirectory.is_publishing_room_allowed( user_id, room_id, room_aliases - ): + ) and not is_requester_admin: # allow room creation to continue but do not publish room await self.store.set_room_is_public(room_id, False)