OxidizeBot
OxidizeBot copied to clipboard
oxidize: Expand the functionality of the "auth" command group
Current behaviour:
-
!auth scopes [filter]
- Allows listing of your temporary scopes, including scopes from your roles. -
!auth permit <duration> <principal> <scope>
- Allows granting of temporary scope to an user or role.
Proposed behaviour:
User story:
- As an user, I want to be able to list my own roles and include/exclude scopes from my roles.
- As an user, I want to be able to list my own scopes and include/exclude scopes from my roles.
- As a moderator or admin, I want to be able to list an user's scopes and include/exclude scopes from their roles.
- As a moderator or admin, I want to be able to grant permanent scopes to users or roles, in addition to temporary ones.
- As a moderator or admin, I want to be able to list an user's roles and include/exclude the scopes they have from their roles.
- As an user, moderator or admin, I want to be able to filter scopes by their names, whether they are from roles or the user itself.
As an idea, named arguments might play nice here:
-
!auth scopes --filter "song"
- List your own scopes, filtering bysong
. -
!auth scopes setbac --filter "song"
- List scopes ofsetbac
, filtering bysong
. -
!auth scopes setbac --exclude-roles
- List scopes ofsetbac
, ignoring scopes from roles. -
!auth roles
- List your own roles. -
!auth roles setbac
- List roles ofsetbac
.
I am not too sure on how to expand !auth permit
as it already takes 3 required positional arguments.
Potential ideas could be:
- Adjust
duration
to have some indicator for permanent. - A new command to grant permanent scopes, separate from
!auth permit
. - Potentially break backwards compability and implement named arguments to
!auth permit
, something similar to above.
P.S. The principal
argument behaviour should probably be documented. @
targets a role, anything else is an user.
Thanks!
I like the idea of named arguments to expand on functionality. Could hook it up to an existing library, like https://docs.rs/structopt/0.3.15/structopt/ to make it more convenient.