Protocols
Section titled “Protocols”AdminContributorProtocol
Section titled “AdminContributorProtocol”Contract for packages that contribute admin dashboard surfaces.
Any oridecon extension package can implement this protocol and register
it via the oridecon.admin.contributors entry point. The admin
dashboard discovers contributors at boot and assembles their widgets,
pages, navigation, and actions into the unified admin UI.
Unique contributor identifier (e.g. ‘cache’, ‘events’, ‘ai’).
Human-readable contributor name for the admin UI.
Navigation group this contributor belongs to.
Lucide icon name for the contributor.
Contributor names that must boot before this contributor.
Ordering priority within its group (lower = first).
Semantic version of this contributor (e.g. ‘1.2.3’).
Python package name that provides this contributor (e.g. ‘oridecon-cache’).
Stable unique identifier used for lookup and RBAC keying (equals name).
Permissions a user must hold to execute any action on this contributor.
Return resource classes managed by this contributor.
Return widget definitions for the main dashboard.
Return navigation entries for the admin sidebar.
Return full management page definitions.
Return settings panel definitions.
Return health check definitions to surface in the dashboard.
Return framework-level actions.
Return route specifications for the admin router.
Called when the admin dashboard boots.
Called when the admin dashboard shuts down.
Render a named widget to a typed WidgetViewModel.
| Parameter | Type | Description |
|---|---|---|
| `widget_name` | str | Name of the widget to render. |
| `params` | WidgetParams | Typed, validated widget parameters. |
| `resolver` | ContainerResolverProtocol | None | Optional DI resolver for lazy dependency injection. |
| Type | Description |
|---|---|
| Result[WidgetViewModel, AdminError] | Ok(WidgetViewModel) with structured content in ``content`` on success. Err(WidgetNotFoundError) when the widget name is unknown. Err(AdminError) for other expected domain failures. Infrastructure exceptions propagate (not caught here). |
Run a health check and return a structured health-check payload.
| Parameter | Type | Description |
|---|---|---|
| `check_name` | str | Name of the health check to run (matches check ID from ``get_health_definitions``). |
| Type | Description |
|---|---|
| Result[HealthCheckPayload, AdminError] | ``Ok(HealthCheckPayload)`` describing the check result on success — the host renders it as HTML. ``Err(HealthCheckNotFoundError)`` if *check_name* is not served by this contributor. ``Err(AdminError)`` if the check fails for any other reason. |
AdminContributorRegistryProtocol
Section titled “AdminContributorRegistryProtocol”Registry that collects and manages admin contributors.
Register a contributor.
Get contributor by name.
Get all registered contributors, ordered by priority.
Get contributors in a specific group.
AdminDashboardProtocol
Section titled “AdminDashboardProtocol”Protocol for the assembled admin dashboard service.
Collect widgets from all contributors.
Collect navigation from all contributors.
Aggregate health from all contributors.
Execute a framework-level action from a contributor.
| Parameter | Type | Description |
|---|---|---|
| `contributor_id` | str | Identifier of the target contributor. |
| `action_name` | str | Name of the action to execute. |
| `params` | dict[str, object] | Parameters forwarded to the action handler. |
| `user_permissions` | frozenset[str] | Permissions held by the requesting user. |
| Type | Description |
|---|---|
| object | Whatever the action handler returns. |
Classes
Section titled “Classes”AdminModule
Section titled “AdminModule”oridecon admin panel module.
Call configure to register the admin panel with its bundle provider and contributor system.
Usage
from oridecon.admin.config import AdminConfig
app.add_modules([ AdminModule.configure( config=AdminConfig(title="My Admin"), resources=[UserResource, ProductResource], ),])from oridecon.admin.config import AdminConfig
app.add_modules([ AdminModule.configure( config=AdminConfig(title="My Admin"), resources=[UserResource, ProductResource], ),])Create an AdminModule with explicit configuration.
| Parameter | Type | Description |
|---|---|---|
| `config` | Any | None | AdminConfig or None for defaults. |
| `auth_provider` | Any | None | Optional AuthProviderProtocol for auth integration. |
| `resources` | list[type] | None | List of Resource classes to register. |
| `controllers` | list[type] | None | List of controller classes to register. **kwargs: Forwarded to AdminProvider. |
| Type | Description |
|---|---|
| DynamicModule | A DynamicModule descriptor. |
Return a no-op AdminModule for testing.
| Parameter | Type | Description |
|---|---|---|
| `config` | Any | Optional admin configuration; ``None`` uses defaults. Honored so test compositions can satisfy boot-time requirements (e.g. the setup-token guard). |
| Type | Description |
|---|---|
| DynamicModule | A DynamicModule with the given (or default) admin configuration. |
AdminPanelStartedHook
Section titled “AdminPanelStartedHook”Payload fired after the admin panel has finished its startup sequence.
AdminPanelStoppedHook
Section titled “AdminPanelStoppedHook”Payload fired after an orderly admin panel shutdown completes.
AdminProvider
Section titled “AdminProvider”Orchestrates admin sub-providers for the full admin panel.
Sub-providers are focused helper classes (not Provider subclasses). This follows the EventsProvider/AuthBundleProvider pattern.
Config is accepted only in init and never mutated after construction. Sub-providers are instantiated in register() — not in init — so that no DI work happens before the container is ready.
Return current admin config.
Create provider from typed config.
Register admin and all sub-providers.
Sub-providers are instantiated here (not in init) so that no DI resolution or heavyweight initialisation happens before the container lifecycle has started. No resolution is performed in this method — only bindings are registered.
Build and mount the admin panel onto a Starlette application.
Called by the web provider during route setup, after the Starlette app is created and all providers have booted.
| Parameter | Type | Description |
|---|---|---|
| `app` | Any | The Starlette application to mount the admin panel on. |
| `container` | ContainerResolverProtocol | The DI resolver for resolving controller dependencies. |
Boot all sub-providers in order.
| Exception | Description |
|---|---|
| RuntimeError | If any mandatory service cannot be resolved — admin must not boot without CSRF enforcement, session validation, or RBAC enforcement (fail-closed). |
Shut down sub-providers in reverse order.
Aggregate health from all sub-providers.
AdminResourceAccessedHook
Section titled “AdminResourceAccessedHook”Payload fired when an admin resource page is accessed.
Attributes:
resource_name: Registered name of the admin resource (e.g. "User").
action: CRUD action being performed (e.g. "list", "change").
user_id: Identifier of the admin user performing the action.
AdminStatus
Section titled “AdminStatus”Status of admin operations.
AdminUser
Section titled “AdminUser”Admin user representation.
BaseAdminContributor
Section titled “BaseAdminContributor”Convenience base class for admin contributors.
Provides no-op defaults for all AdminContributorProtocol methods.
Subclasses override only the methods they need.
Stable identifier for RBAC lookup — equals name.
Return an empty sequence by default.
Return an empty sequence by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
No-op boot hook.
No-op shutdown hook.
Return a not-found error by default — override in subclasses.
Default: this contributor does not serve the requested health check.
| Parameter | Type | Description |
|---|---|---|
| `check_name` | str | Name of the health check requested. |
| Type | Description |
|---|---|
| Result[HealthCheckPayload, AdminError] | ``Err(HealthCheckNotFoundError)`` — contributor does not provide this check. |
ContributorRegistry
Section titled “ContributorRegistry”Registry that collects and manages admin contributors.
Follows the core Registry pattern: empty __init__ and no in-package
built-in set — contributors are registered explicitly by providers, so
there is no with_defaults(). Ordering follows each contributor’s
priority (lower = first) via the core priority_key hook.
Initialize an empty contributor registry.
Duplicate names overwrite (last registration wins), matching the previous hand-rolled mapping semantics — contributor providers may re-register an upgraded instance during app bootstrapping.
Register a contributor, keyed by its name.
Registering a duplicate name raises the core
RegistryAlreadyExistsError; use allow_overwrite=True on the
core register() when an override is intended.
Get all contributors sorted by priority (lower = first).
Get contributors in a specific group, sorted by priority.
CoreAdminContributor
Section titled “CoreAdminContributor”Built-in contributor providing core dashboard surfaces.
Provides the framework health overview widget, the main dashboard navigation entry, and the system-wide health check surface.
Cancel the background activity tail, then mark the contributor down.
Receive the mounted-resource inventory from the mount pipeline.
Called at mount time (duck-typed hook, see
AdminProvider._mount_contributors) with a
ResourceInventory
so the Resource Overview widget can report live record counts.
| Parameter | Type | Description |
|---|---|---|
| `inventory` | Any | The resource inventory built over mounted resources. |
Return core dashboard widgets: health, resource overview, activity, and metrics.
Enable the Exports sidebar entry.
Called at mount time (duck-typed hook, see
AdminProvider._mount_export_center) only after the export
center routes registered successfully, so the nav item never
points at a missing page.
| Parameter | Type | Description |
|---|---|---|
| `url` | str | Absolute admin path of the exports page. |
Return core navigation: Dashboard, plus Exports when mounted.
Return core health definitions.
Contribute the read-only System Info diagnostics panel.
Render core widgets.
| Parameter | Type | Description |
|---|---|---|
| `widget_name` | str | Name of the widget to render. |
| `params` | WidgetParams | Widget parameters. |
| Type | Description |
|---|---|
| Result[WidgetViewModel, AdminError] | Result containing a WidgetViewModel with structured ``content``, or WidgetNotFoundError if the widget is not found. |
Render health check for admin core.
| Parameter | Type | Description |
|---|---|---|
| `check_name` | str | Name of the health check. |
| Type | Description |
|---|---|
| Result[HealthCheckPayload, AdminError] | Ok(HealthCheckPayload) with the core status, or Err(AdminError) when the check is unknown. |
ErrorCode
Section titled “ErrorCode”Machine-readable error codes for admin operations.
Exceptions
Section titled “Exceptions”AdminError
Section titled “AdminError”Base exception for all admin errors.
AdminValidationError
Section titled “AdminValidationError”Raised when validation fails.
ConflictError
Section titled “ConflictError”Raised when a resource conflict occurs.
DataError
Section titled “DataError”Raised when a data source or database error occurs in admin.
NotFoundError
Section titled “NotFoundError”Raised when a resource is not found.
NotificationError
Section titled “NotificationError”Raised when a notification fails to send.
PermissionDeniedError
Section titled “PermissionDeniedError”Raised when permission is denied.