permissions
Types for permissions.
Permission
¶
Bases: str, Enum
A permission string, resource:action.
Two shapes, one rule — an account either holds a permission or it does not:
- Actions on a resource you operate on:
create,read,update,delete, andallas the wildcard that implies the other four (project:read,recording:create). A resource may carry only the actions that mean something for it (api_key:create: listing and revoking your own keys is account management). - A capability flag: a resource with the single action
enabled(recording_download:enabled). Holding it grants the capability; not holding it is the only "off" there is. A stored "disabled" state would be a second source that the guard never reads.
action
property
¶
Get the action of the permission.
description
property
¶
Get the description of the permission.
resource
property
¶
Get the resource of the permission.
as_tuple()
¶
Split the permission into resource and action.
with_action(action)
¶
Return a new permission with the same resource but a different action.