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 resource's other actions (project:read,recording:create). A resource carries only the actions some route checks: history is only read, and a recording is created and deleted but never updated (api_key:create: listing and revoking your own keys is account management). A value no route checks would be a scope that grants nothing. - 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.