Permissions
rn_forge.auth.permissions
Permission keys: the action-to-key mapping and the scope limit on tokens.
effective_permissions(permissions, *, mechanism, scopes, scope_map)
The permissions a caller may exercise, after the scope limit.
A session or basic caller keeps permissions unchanged. A
bearer caller keeps only the permissions that its scopes allow through
scope_map; a scope absent from the map allows nothing, and scopes never
add permissions the account lacks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
permissions
|
frozenset[str]
|
The account's permissions. |
required |
mechanism
|
Mechanism
|
How the caller authenticated. |
required |
scopes
|
frozenset[str]
|
The scopes of the verified token. |
required |
scope_map
|
Mapping[str, frozenset[str]]
|
The permissions each accepted scope allows. |
required |
requirement_for(permission_key, action, *, action_map=None)
The :class:Requirement for performing action on permission_key.
The action is mapped to a permission suffix and joined to the key:
requirement_for("orders", "partial_update") requires orders.update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
permission_key
|
str
|
The resource's base permission key, such as |
required |
action
|
str
|
The action name, such as a viewset action. |
required |
action_map
|
Mapping[str, str] | None
|
Entries that override :data: |
None
|
Returns:
| Type | Description |
|---|---|
Requirement
|
A requirement of |