New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a constraint that matches to room permission level #1083
Comments
I think this is one of the areas that we are going to find wildly different models between connectors and therefore trying to write a universal constraint will be hard/impossible. I would be tempted to just try and namespace the import and write a matrix specific one. E.g from opsdroid.connectors.matrix.constraints import constrain_room_permissions
@constrain_room_permissions(100)
def my_skill(*args, **kwargs):
pass Or a slack specific one. E.g from opsdroid.connectors.slack.constraints import constrain_workspace_admin, constrain_workspace_owner
@constrain_workspace_admin
def my_skill(*args, **kwargs):
pass
@constrain_workspace_owner
def my_other_skill(*args, **kwargs):
pass Similar to the connector specific events. I guess if you wanted to try and also implement a universal |
Heh looking at the Slack API there are some fun things we could do with this and #1085. from opsdroid.skill import Skill
from opsdroid.matchers import match_parse
from opsdroid.connectors.slack.constraints import constrain_has_2fa, constrain_workspace_admin
class MySkill(Skill):
@match_parse('do some admin thing!')
@constrain_workspace_admin
@constrain_has_2fa(invert=True)
async def admin_thing(self, message):
await message.respond("Pfft you might be an admin but you don't have 2FA turned on, how do I know it's really you!") |
Of these I think the per-connector approach is better for the flexibility. I think for a few things we might be able to wrap connector-specific things in a more generic core constraint, but I don't know how much that would really benefit us. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Quite often you only want certain actions to be able to be taken by users who have a given permission level in a room.
In matrix (which I am most familiar with) you would have an integer number represent the power level:
I am not clear on what a cross-connector solution for this would look like.
The text was updated successfully, but these errors were encountered: