From 88961d700563b13f141e9ed3c6f68620ad0d2cfc Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 14 Nov 2021 22:55:25 +0100 Subject: [PATCH] Now the admin and gm menuentries will show up when logged in with an account which has the necessary privileges. --- app/mourne_application.cpp | 54 ++++++++++++++++++++++++++------------ app/mourne_application.h | 6 +++-- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/app/mourne_application.cpp b/app/mourne_application.cpp index 10e4702..7cd4f86 100644 --- a/app/mourne_application.cpp +++ b/app/mourne_application.cpp @@ -14,9 +14,9 @@ #include "core/http/http_session.h" #include "core/http/session_manager.h" +#include "modules/admin_panel/admin_panel.h" #include "modules/users/user.h" #include "modules/users/user_controller.h" -#include "modules/admin_panel/admin_panel.h" #include "buildings/building_initializer.h" #include "village/village_initializer.h" @@ -69,6 +69,20 @@ void MourneApplication::add_menu(Request *request, const MenuEntries index) { HTMLTag *t; + int userlevel = 0; + + if (request->session) { + Ref user = request->reference_data["user"]; + + if (user.is_valid()) { + userlevel = user->rank; + } + } + + if (userlevel > 4) { + request->head += admin_headers; + } + /*