From ac5fd153e36f3cceb96ffd9e7af9ca967d9b9215 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 9 Mar 2024 14:35:37 +0900 Subject: show ranking chart for admin users --- services/app/src/App.php | 4 +++- services/app/templates/admin_answer_list.html.twig | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/services/app/src/App.php b/services/app/src/App.php index b2ffba0..aef1b12 100644 --- a/services/app/src/App.php +++ b/services/app/src/App.php @@ -954,7 +954,9 @@ final class App 'error' => 'not_found', ])->withStatus(404); } - if ($quiz->isRankingHidden()) { + $currentUser = $this->getCurrentUser($request); + $isAdmin = $currentUser !== null ? $currentUser->is_admin : false; + if ($quiz->isRankingHidden() && !$isAdmin) { return $this->makeJsonResponse($response, [ 'error' => 'forbidden', ])->withStatus(403); diff --git a/services/app/templates/admin_answer_list.html.twig b/services/app/templates/admin_answer_list.html.twig index 68f0089..5d07d92 100644 --- a/services/app/templates/admin_answer_list.html.twig +++ b/services/app/templates/admin_answer_list.html.twig @@ -38,4 +38,9 @@ {% endfor %} + +
+ + +
{% endblock %} -- cgit v1.2.3-70-g09d2