Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Allow admins to create aliases when they are not in the room #7191

Merged
merged 3 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7191.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Admin users are no longer required to be in a room to create an alias for it.
6 changes: 5 additions & 1 deletion synapse/handlers/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ def create_association(
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(
Expand Down