From 8b0cbe23d14cbf081a239594ed7224d98043e5a8 Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 5 Mar 2024 09:19:15 +0100 Subject: [PATCH] show year selector to admins for logbook --- src/model/user.rs | 2 +- templates/log.completed.html.tera | 39 ++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/model/user.rs b/src/model/user.rs index 00d66a6..9ae4a3d 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -753,7 +753,7 @@ impl<'r> FromRequest<'r> for AdminUser { if user.has_role(db, "admin").await { Outcome::Success(AdminUser { user }) } else { - Outcome::Error((Status::Forbidden, LoginError::NotACox)) + Outcome::Forward(Status::Forbidden) } } Outcome::Error(f) => Outcome::Error(f), diff --git a/templates/log.completed.html.tera b/templates/log.completed.html.tera index 2568f5d..1edaefa 100644 --- a/templates/log.completed.html.tera +++ b/templates/log.completed.html.tera @@ -3,7 +3,16 @@ {% extends "base" %} {% block content %}
-

Logbuch

+

+ Logbuch + {% if "admin" in loggedin_user.roles %} + + {% endif %} +

@@ -17,4 +26,32 @@ {% for log in logs %}{{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }}{% endfor %}
+ {% endblock content %}