THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
Create permissions and roles, and attach them to identities.
Database unique constraints decide concurrent insertions. Duplicate recovery uses a transaction or savepoint and verifies that the desired row exists before treating the operation as idempotent.
Concurrency
The registrar is stateless and safe as a singleton. Duplicate inserts lose against the primary or unique key and are resolved by reading the row that won.
| Async Method | __attach |
Insert a pivot row, ignoring an already existing one. |
| Async Method | __find |
Return the identifier of a named permission or role. |
| Async Method | __first |
Return the identifier of a row, inserting it when missing. |
| Method | __init__ |
Initialise the registrar with the model-less query gateway. |
| Async Method | __recover |
Observe a failed recovery query while preserving the write failure. |
| Async Method | assign |
Attach roles to an identity. |
| Async Method | create |
Create a permission, or return the existing one. |
| Async Method | create |
Create a role, or return the existing one. |
| Async Method | give |
Attach direct permissions to an identity. |
| Async Method | grant |
Attach permissions to a role. |
| Async Method | remove |
Detach roles from an identity. |
| Async Method | revoke |
Detach permissions from a role. |
| Async Method | revoke |
Detach direct permissions from an identity. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | __db |
Gateway used to build queries over the authorization tables. |
Return the identifier of a row, inserting it when missing.
The unique key decides concurrent insertions. A nested transaction rolls back a losing insert before the winning row is read, without aborting the caller's transaction.
| Parameters | |
table:str | Table holding the named rows. |
name:str | Name of the row. |
| Returns | |
object | Identifier of the existing or freshly created row. |
| Raises | |
orionis.database.QueryException | When the insert fails for a reason other than a duplicate. |
orionis.auth.AuthException | When the name is empty, padded or longer than the schema permits. |
Initialise the registrar with the model-less query gateway.
| Parameters | |
db:orionis.orm.contracts.query_builder.IQueryBuilder | Gateway used to build queries over the authorization tables. |
| Returns | |
None | No return value. |
Observe a failed recovery query while preserving the write failure.
| Parameters | |
lookup:collections.abc.Awaitable[object] | Read that determines whether a concurrent writer created the row. |
operation:str | Authorization operation associated with the recovery attempt. |
| Returns | |
object or None | Lookup result, or None when an observed query failure prevents duplicate confirmation and the caller must re-raise its write error. |
Attach roles to an identity.
| Parameters | |
authorizable:orionis.auth.contracts.IAuthorizable | Identity receiving the roles. |
*roles:str | Role names. Missing roles are created. |
| Returns | |
None | No return value. |
Attach direct permissions to an identity.
| Parameters | |
authorizable:orionis.auth.contracts.IAuthorizable | Identity receiving the permissions. |
*permissions:str | Permission names. Missing permissions are created. |
| Returns | |
None | No return value. |
Detach roles from an identity.
| Parameters | |
authorizable:orionis.auth.contracts.IAuthorizable | Identity losing the roles. |
*roles:str | Role names. Unknown names are ignored. |
| Returns | |
None | No return value. |
Detach direct permissions from an identity.
| Parameters | |
authorizable:orionis.auth.contracts.IAuthorizable | Identity losing the permissions. |
*permissions:str | Permission names. Unknown names are ignored. |
| Returns | |
None | No return value. |