From e6218e48800a613e6c8f3d008cd90e4a01194fe5 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Tue, 16 Apr 2019 16:41:01 +0100 Subject: [DINSIC] Block internal users from inviting external users to a public room (#5061) Co-Authored-By: babolivier --- synapse/storage/room.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'synapse/storage/room.py') 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 -- cgit 1.5.1