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

Commit

Permalink
Check on room creation if the user is allowed to publish the room to …
Browse files Browse the repository at this point in the history
…the room directory. (#7260)
  • Loading branch information
PeerD authored Apr 13, 2020
1 parent 118b58f commit f41b742
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/7260.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix room publish permissions not being checked on room creation.
7 changes: 7 additions & 0 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,13 @@ def create_room(self, requester, config, ratelimit=True, creator_join_profile=No
check_membership=False,
)

if is_public:
if not self.config.is_publishing_room_allowed(user_id, room_id, room_alias):
# Lets 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?
raise SynapseError(403, "Not allowed to publish room")

preset_config = config.get(
"preset",
RoomCreationPreset.PRIVATE_CHAT
Expand Down

0 comments on commit f41b742

Please sign in to comment.