summary refs log tree commit diff
path: root/synapse/handlers/directory.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-04-01 08:27:05 -0400
committerGitHub <noreply@github.com>2020-04-01 08:27:05 -0400
commit468dcc767bf379ba2b4ed4b6d1c6537473175eab (patch)
treec6197b906c0e9a40e0a72cb7373b77046c4384bf /synapse/handlers/directory.py
parentUpdate postgres.md (#7119) (diff)
downloadsynapse-468dcc767bf379ba2b4ed4b6d1c6537473175eab.tar.xz
Allow admins to create aliases when they are not in the room (#7191)
Diffstat (limited to 'synapse/handlers/directory.py')
-rw-r--r--synapse/handlers/directory.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py
index 1d842c369b..53e5f585d9 100644
--- a/synapse/handlers/directory.py
+++ b/synapse/handlers/directory.py
@@ -127,7 +127,11 @@ class DirectoryHandler(BaseHandler):
                     errcode=Codes.EXCLUSIVE,
                 )
         else:
-            if self.require_membership and check_membership:
+            # Server admins are not subject to the same constraints as normal
+            # users when creating an alias (e.g. being in the room).
+            is_admin = yield self.auth.is_server_admin(requester.user)
+
+            if (self.require_membership and check_membership) and not is_admin:
                 rooms_for_user = yield self.store.get_rooms_for_user(user_id)
                 if room_id not in rooms_for_user:
                     raise AuthError(