From 1cba969100ca15e3441bf2476d2917e6e591b566 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Thu, 31 Mar 2022 17:58:00 +0200 Subject: [PATCH] Minor refactor --- src/app.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app.rb b/src/app.rb index 303844f..0d4b979 100755 --- a/src/app.rb +++ b/src/app.rb @@ -43,7 +43,8 @@ not_found do serve :"404" end -def auth_denied(msg="You are not permitted to do that!") +def auth_denied(msg="You are not permitted to do that!", status=403) + session[:status] = status flash[:error] = msg redirect "/" end @@ -217,8 +218,8 @@ get "/admin" do p flags.to_s(2) user = get_current_user - banned unless !user.banned? - auth_denied unless user.flags != 0 + banned unless !user.banned? # reject the user if banned + auth_denied unless user.flags != 0 # reject the user if he/she has no roles serve :admin, {flags: flags} end