Skip to content
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

Role based access control (RBAC) for bot functions #7

Open
arvindpunk opened this issue Oct 20, 2020 · 0 comments
Open

Role based access control (RBAC) for bot functions #7

arvindpunk opened this issue Oct 20, 2020 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@arvindpunk
Copy link
Member

Summary

To implement an RBAC system, similar to how AWS roles are used.

Add tier-wise roles to every user (admin > moderator > everyone (or no-role)), each users/user ID's is mapped to one of these roles (for persistence during restarts, requires a DB).

Every user invokable function should have some identification (a decorator, perhaps?) - which checks if the invoker has enough permissions to invoke the function. The body of the function itself should only contain the business logic pertaining to that function and not related to permissions.

Implementation

Examples speak for themselves,

@everyone
def xkcd(update, context):
    ...

@moderator
def kick(...):
    ...

New roles can be made by creating its decorator function, and adding the role name to the priority list. Role to permission(s) mapping is something to be thought of as well.

rolePriorityList = ['admin', 'moderator', 'everyone']

Additional (optional) enhancements,

  1. HIgher priority role should have permissions of all roles below?
  2. An admin only function for giving roles (like /addrole @tag moderator)
@rexagod rexagod added enhancement New feature or request help wanted Extra attention is needed labels Oct 21, 2020
@rexagod rexagod pinned this issue Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants