diff options
author | Matthew Hodgson <matthew@matrix.org> | 2016-03-29 01:20:25 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2016-03-29 01:20:25 +0100 |
commit | e0c2490a145550310edb3ad0a414aa1840ef3ce4 (patch) | |
tree | 3d9ba7834e859171397ac7136ccb82123b4cd8ce /synapse/handlers/directory.py | |
parent | Merge branch 'develop' into matthew/preview_urls (diff) | |
parent | typo (diff) | |
download | synapse-e0c2490a145550310edb3ad0a414aa1840ef3ce4.tar.xz |
Merge branch 'develop' into matthew/preview_urls
Diffstat (limited to 'synapse/handlers/directory.py')
-rw-r--r-- | synapse/handlers/directory.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py index 6bcc5a5e2b..8eeb225811 100644 --- a/synapse/handlers/directory.py +++ b/synapse/handlers/directory.py @@ -317,3 +317,25 @@ class DirectoryHandler(BaseHandler): is_admin = yield self.auth.is_server_admin(UserID.from_string(user_id)) defer.returnValue(is_admin) + + @defer.inlineCallbacks + def edit_published_room_list(self, requester, room_id, visibility): + """Edit the entry of the room in the published room list. + + requester + room_id (str) + visibility (str): "public" or "private" + """ + if requester.is_guest: + raise AuthError(403, "Guests cannot edit the published room list") + + if visibility not in ["public", "private"]: + raise SynapseError(400, "Invalid visibility setting") + + room = yield self.store.get_room(room_id) + if room is None: + raise SynapseError(400, "Unknown room") + + yield self.auth.check_can_change_room_list(room_id, requester.user) + + yield self.store.set_room_is_public(room_id, visibility == "public") |