From f034a780a20e4d4df962fd2291e0648f69f646a5 Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 6 Apr 2023 18:57:10 +0200 Subject: [PATCH] send loggedin_user in /admin/user --- README.md | 1 - src/model/user.rs | 3 ++- src/rest/admin/user.rs | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cf9a812..05eab09 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ # Notes / Bugfixes - [ ] User loggedin status not present on user admin interface (header/footer not rendering) [ph] -- [ ] is_cox: cox can become cox and than rower at the same event, (rower and than cox -> exception working) [ph] - [ ] Mobile Breakpoint: Add user broken user admin interface [mb] # Frontend Process diff --git a/src/model/user.rs b/src/model/user.rs index 24acda1..42044cf 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -204,8 +204,9 @@ impl<'r> FromRequest<'r> for CoxUser { } } +#[derive(Debug, Serialize, Deserialize)] pub struct AdminUser { - user: User, + pub(crate) user: User, } impl TryFrom for AdminUser { diff --git a/src/rest/admin/user.rs b/src/rest/admin/user.rs index 6a0be2d..be3c3b8 100644 --- a/src/rest/admin/user.rs +++ b/src/rest/admin/user.rs @@ -9,9 +9,12 @@ use rocket_dyn_templates::{context, Template}; use sqlx::SqlitePool; #[get("/user")] -async fn index(db: &State, _admin: AdminUser) -> Template { +async fn index(db: &State, admin: AdminUser) -> Template { let users = User::all(db).await; - Template::render("admin/user/index", context!(users)) + Template::render( + "admin/user/index", + context!(users, loggedin_user: admin.user), + ) } #[get("/user//reset-pw")]