loom.core.authz.elevation¶
Elevation frames: which scopes an execution may write beyond its own rows.
A frame lives exactly as long as one use-case execution. elevate_scope
records a scope in the open frame after checking the decision that justifies
it, and asks the sink to flag the open transaction when there is one; the
session-settings provider reads elevated_scopes for every later
transaction. Tasks spawned inside the execution share the frame object and
lose the elevation when it closes. Nothing here knows a database.
Functions
|
|
|
|
|
|
|
|
|
Record |
Scopes elevated by the execution running in this context; empty outside one. |
|
|
Open a frame for one execution; nested frames inherit and never mutate their parent. |
Whether an execution frame is open in this context. |
Classes
|
How the frame reaches the transaction that is open right now. |
|
- class loom.core.authz.elevation.ElevationSink(*args, **kwargs)[source]¶
Bases:
ProtocolHow the frame reaches the transaction that is open right now.
- loom.core.authz.elevation.in_execution_frame()[source]¶
Whether an execution frame is open in this context.
- Return type:
- loom.core.authz.elevation.elevated_scopes()[source]¶
Scopes elevated by the execution running in this context; empty outside one.
- loom.core.authz.elevation.elevation_scope(*, owns_transaction, sink=None)[source]¶
Open a frame for one execution; nested frames inherit and never mutate their parent.
- Parameters:
owns_transaction (bool)
sink (ElevationSink | None)
- Return type:
AsyncIterator[None]
- async loom.core.authz.elevation.elevate_scope(scope, decision, *, at, permission, catalog)[source]¶
Record
scopeas elevated for the rest of the execution.- Raises:
RuntimeError – Outside an execution frame.
PermissionError – When the decision is denied, its grant’s role lacks
permission, or its grant does not coverat.
- Parameters:
scope (str)
decision (Decision)
at (Scope)
permission (Permission)
catalog (RoleCatalog)
- Return type:
None