diff --git a/inc/navbar.php b/inc/navbar.php index 09d0ec0..d902756 100644 --- a/inc/navbar.php +++ b/inc/navbar.php @@ -25,7 +25,8 @@ function navbar($depth, $active = NULL) { return $result . "\t\n"; } -function loginBar($sp = 'default-sp') { +function loginBar($sp = null, $pdo = null) { + if (is_null($sp)) $sp = 'default-sp'; $result = "\n"; require_once(__DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php'); $as = new SimpleSAML_Auth_Simple($sp); @@ -44,10 +45,19 @@ function loginBar($sp = 'default-sp') { $attr = $as->getAttributes(); if($attr) { $uname = $attr['uid'][0]; + if (isset($pdo)) { + $userManager = new \pvv\admin\UserManager($pdo); + $isAdmin = $userManager->isAdmin($uname); + } else { + $isAdmin = false; + } $result .= "\t${svgWhite}" . htmlspecialchars($uname) . "\n"; $result .= "\n\t
\n"; } else { diff --git a/www/admin/index.php b/www/admin/index.php index c210b47..906631c 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -18,7 +18,8 @@ $projectGroup = $userManager->hasGroup($uname, 'prosjekt'); $activityGroup = $userManager->hasGroup($uname, 'aktiviteter'); if(!($isAdmin | $projectGroup | $activityGroup)){ - echo 'Her har du ikke lov\'t\'å\'værra!!!'; + header('Content-Type: text/plain', true, 403); + echo "Her har du ikke lov't'å'værra!!!\r\n"; exit(); } ?> @@ -54,5 +55,5 @@ if(!($isAdmin | $projectGroup | $activityGroup)){ diff --git a/www/aktiviteter/index.php b/www/aktiviteter/index.php index 5a3674c..c9bca84 100644 --- a/www/aktiviteter/index.php +++ b/www/aktiviteter/index.php @@ -80,5 +80,5 @@ foreach($events as $event) { diff --git a/www/kontakt/index.php b/www/kontakt/index.php index e37a0d9..053683b 100755 --- a/www/kontakt/index.php +++ b/www/kontakt/index.php @@ -39,5 +39,5 @@ Det er også mulig å ta i bruk analog kontakt ved å møte opp