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.
Map resource classes to the policy classes protecting them.
Lookups walk the method resolution order once and memoise the result, so an inherited policy costs a single dictionary read after the first request that needed it. The lookup cache holds resource classes weakly; only explicit registrations retain their resource and policy classes.
Concurrency
Registration happens during application boot. The lookup cache is a pure function of the registry, so a concurrent first lookup may compute the same value twice without any observable difference.
| Method | __init__ |
Initialise an empty registry. |
| Method | bindings |
Return a copy of the registered resource to policy bindings. |
| Method | policy |
Return the policy protecting a resource class. |
| Method | register |
Bind a policy class to a resource class. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | __lookup |
Weakly keyed resolutions that do not retain unregistered resource classes. |
| Instance Variable | __policies |
Policy classes registered for each protected resource type. |
Return a copy of the registered resource to policy bindings.
| Returns | |
dict[type, type[orionis.auth.contracts.IPolicy]] | Shallow copy, so callers cannot mutate the registry. |
Return the policy protecting a resource class.
| Parameters | |
resource:type | Resource class to look a policy up for. |
| Returns | |
type[orionis.auth.contracts.IPolicy] | None | Registered policy class, or None when the resource and none of its ancestors declare one. |
Bind a policy class to a resource class.
| Parameters | |
resource:type | Resource class protected by the policy. |
policy:type[orionis.auth.contracts.IPolicy] | Policy class implementing the abilities. |
| Returns | |
None | No return value. |
| Raises | |
TypeError | If either argument is not a class. |