diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2020-05-01 15:15:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 15:15:36 +0100 |
commit | 6b22921b195c24762cd7c02a8b8fad75791fce70 (patch) | |
tree | 9ee0c395a0904de1e18803fa4238e4ee348d4297 /synapse/api | |
parent | Further improvements to requesting the public rooms list on a homeserver whic... (diff) | |
download | synapse-6b22921b195c24762cd7c02a8b8fad75791fce70.tar.xz |
async/await is_server_admin (#7363)
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/auth.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index c1ade1333b..c5d1eb952b 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -537,8 +537,7 @@ class Auth(object): return defer.succeed(auth_ids) - @defer.inlineCallbacks - def check_can_change_room_list(self, room_id: str, user: UserID): + async def check_can_change_room_list(self, room_id: str, user: UserID): """Determine whether the user is allowed to edit the room's entry in the published room list. @@ -547,17 +546,17 @@ class Auth(object): user """ - is_admin = yield self.is_server_admin(user) + is_admin = await self.is_server_admin(user) if is_admin: return True user_id = user.to_string() - yield self.check_user_in_room(room_id, user_id) + await self.check_user_in_room(room_id, user_id) # We currently require the user is a "moderator" in the room. We do this # by checking if they would (theoretically) be able to change the # m.room.canonical_alias events - power_level_event = yield self.state.get_current_state( + power_level_event = await self.state.get_current_state( room_id, EventTypes.PowerLevels, "" ) |