summary refs log tree commit diff
path: root/synapse/storage/room.py
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-04-16 16:41:01 +0100
committerErik Johnston <erikj@jki.re>2019-04-16 16:41:01 +0100
commite6218e48800a613e6c8f3d008cd90e4a01194fe5 (patch)
treeb60dd24b637723a8cee735d67d80a3be713f89d9 /synapse/storage/room.py
parentMerge branch 'develop' into dinsic (diff)
downloadsynapse-e6218e48800a613e6c8f3d008cd90e4a01194fe5.tar.xz
[DINSIC] Block internal users from inviting external users to a public room (#5061)
Co-Authored-By: babolivier <contact@brendanabolivier.com>
Diffstat (limited to 'synapse/storage/room.py')
-rw-r--r--synapse/storage/room.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py

index fe9d79d792..87854ae08c 100644 --- a/synapse/storage/room.py +++ b/synapse/storage/room.py
@@ -171,6 +171,24 @@ class RoomWorkerStore(SQLBaseStore): desc="is_room_blocked", ) + @defer.inlineCallbacks + def is_room_published(self, room_id): + """Check whether a room has been published in the local public room + directory. + + Args: + room_id (str) + Returns: + bool: Whether the room is currently published in the room directory + """ + # Get room information + room_info = yield self.get_room(room_id) + if not room_info: + defer.returnValue(False) + + # Check the is_public value + defer.returnValue(room_info.get("is_public", False)) + @cachedInlineCallbacks(max_entries=10000) def get_ratelimit_for_user(self, user_id): """Check if there are any overrides for ratelimiting for the given