* admin_user_repo: surface instance_role + email on AdminUserRow / Credentials; create() now takes instance_role; add update_instance_role, list_active_owners, count_other_active_owners. * admin_users_api: DTO + create/patch accept instance_role (defaults to Admin on create — only env-var bootstrap defaults to Owner). PATCH and DELETE enforce the last-owner guard alongside the existing last-active-admin guard. * app_members_repo: new — implements AuthzRepo::membership via the app_members table plus upsert/remove/list_for_user/list_for_app. * api_key_repo: new — create / find_active_by_prefix / touch_last_used / list_for_user / get / delete_by_id_and_user / expire_all_for_user. Separates ApiKeyRow (no hash) from ApiKeyVerification (hash, for the middleware verifier) so handlers can't leak the hash. * auth_bootstrap + picloud tests: pass Owner on the bootstrap seed and on the test admin seed respectively; in-memory test repo implements the new trait methods. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
65 lines
2.3 KiB
Rust
65 lines
2.3 KiB
Rust
//! Control plane: script storage, scheduling, configuration.
|
|
//!
|
|
//! Single-writer to Postgres. The orchestrator may *read* scripts from
|
|
//! the same DB for now; once we add caching and per-node ingress, the
|
|
//! manager will publish change events.
|
|
|
|
pub mod admin_session_repo;
|
|
pub mod admin_user_repo;
|
|
pub mod admin_users_api;
|
|
pub mod api;
|
|
pub mod api_key_repo;
|
|
pub mod app_bootstrap;
|
|
pub mod app_domain_repo;
|
|
pub mod app_members_repo;
|
|
pub mod app_repo;
|
|
pub mod apps_api;
|
|
pub mod auth;
|
|
pub mod auth_api;
|
|
pub mod auth_bootstrap;
|
|
pub mod auth_middleware;
|
|
pub mod authz;
|
|
pub mod log_sink;
|
|
pub mod migrations;
|
|
pub mod repo;
|
|
pub mod route_admin;
|
|
pub mod route_repo;
|
|
pub mod sandbox;
|
|
pub mod scheduler;
|
|
|
|
pub use admin_session_repo::{
|
|
AdminSessionLookup, AdminSessionRepository, AdminSessionRepositoryError,
|
|
PostgresAdminSessionRepository,
|
|
};
|
|
pub use admin_user_repo::{
|
|
AdminUserCredentials, AdminUserRepository, AdminUserRepositoryError, AdminUserRow,
|
|
PostgresAdminUserRepository,
|
|
};
|
|
pub use admin_users_api::{admins_router, AdminsState};
|
|
pub use api::{admin_router, AdminState};
|
|
pub use api_key_repo::{
|
|
ApiKeyRepository, ApiKeyRepositoryError, ApiKeyRow, ApiKeyVerification, NewApiKey,
|
|
PostgresApiKeyRepository,
|
|
};
|
|
pub use app_bootstrap::{seed_hello_world_if_fresh, HelloWorldOutcome};
|
|
pub use app_domain_repo::{AppDomainRepository, NewAppDomain, PostgresAppDomainRepository};
|
|
pub use app_members_repo::{
|
|
AppMembersRepository, AppMembersRepositoryError, AppMembershipRow, PostgresAppMembersRepository,
|
|
};
|
|
pub use app_repo::{AppLookup, AppRepository, PostgresAppRepository};
|
|
pub use apps_api::{apps_router, AppsState};
|
|
pub use auth_api::auth_router;
|
|
pub use auth_bootstrap::{
|
|
bootstrap_first_admin, bootstrap_first_admin_with, BootstrapEnv, BootstrapError,
|
|
};
|
|
pub use auth_middleware::{require_admin, AuthState, AuthedAdmin, SESSION_COOKIE};
|
|
pub use authz::{can, require, AuthzDenied, AuthzError, AuthzRepo, Capability, Decision};
|
|
pub use log_sink::PostgresExecutionLogSink;
|
|
pub use repo::{
|
|
ExecutionLogRepository, NewScript, PostgresExecutionLogRepository, PostgresScriptRepository,
|
|
RepoResolver, ScriptPatch, ScriptRepository, ScriptRepositoryError,
|
|
};
|
|
pub use route_admin::{compile_routes, route_admin_router, RouteAdminState};
|
|
pub use route_repo::{NewRoute, PostgresRouteRepository, RouteRepository};
|
|
pub use sandbox::{CeilingError, SandboxCeiling};
|