Check specific permission for RSS management

This commit is contained in:
Tulir Asokan 2019-04-12 21:37:08 +03:00
parent 6dbb12f2d4
commit e92d8fceb9

View File

@ -161,8 +161,12 @@ class RSSBot(Plugin):
if evt.sender in self.config["admins"]:
return True
levels = await self.get_power_levels(evt.room_id)
if levels.get_user_level(evt.sender) < levels.state_default:
await evt.reply("You don't the permission to manage the subscriptions of this room.")
user_level = levels.get_user_level(evt.sender)
state_level = levels.events.get("xyz.maubot.rss", levels.state_default)
if type(state_level) != int:
state_level = 50
if user_level < state_level:
await evt.reply("You don't have the permission to manage the subscriptions of this room.")
return False
return True