1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! Auto-generated CRUD admin for rustango models.
//!
//! Reads the `inventory` registry that every `#[derive(Model)]` fills
//! and serves an axum [`axum::Router`] over it. No per-model code.
//!
//! ```ignore
//! use rustango::{migrate, admin};
//! use rustango::sql::sqlx::PgPool;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let pool = PgPool::connect(&std::env::var("DATABASE_URL")?).await?;
//! migrate::apply_all(&pool).await?;
//!
//! let app = admin::router(pool);
//! let listener = tokio::net::TcpListener::bind("127.0.0.1:8080").await?;
//! axum::serve(listener, app).await?;
//! Ok(())
//! }
//! ```
//!
//! Routes, all under the configured admin prefix:
//! * `GET /` list every registered model
//! * `GET /<table>` list rows
//! * `GET /<table>/new` create form
//! * `POST /<table>` submit create
//! * `GET /<table>/<pk>` detail view
//! * `GET /<table>/<pk>/edit` edit form, with a read-only PK
//! * `POST /<table>/<pk>` submit edit
//! * `POST /<table>/<pk>/delete` submit delete
//!
//! ## Module layout
//!
//! - [`urls`]: `router(pool)`, `Builder`, `Config`, `AppState`.
//! - [`views`]: one async fn per route.
//! - [`helpers`]: model lookup, FK joins, cell and form rendering, pager.
//! - [`templates`]: the bundled Tera registry and the render entry point.
//! - [`errors`]: `AdminError` and its `IntoResponse` impl.
//! - `forms`, `render`, `auth`: value parsing, HTML rendering, HTTP
//! Basic auth middleware.
pub
/// OpenID Connect and social-OAuth login for the admin. The core is
/// shared with the tenant admin. It signs in by `(provider, sub)` link and
/// never creates an account.
/// `SsoProvider` model: one OIDC or social provider per row, managed
/// from the admin UI.
/// Storage for admin TOTP (two-factor) devices. Without the `totp`
/// feature there is no 2FA challenge.
// `pub(crate)` so the operator console can reuse `render_input` and
// `render_value_for_input` for its `/orgs/{slug}/edit` form. The
// signatures stay internal to the crate.
pub
pub use protect_with_basic_auth;
pub use ;
pub use ;
pub use AdminError;
pub use ;
pub use create_admin_cmd;
pub use ;
pub use ;
pub use ;
pub use SsoProvider;
pub use ;
pub use AdminUser;