\n";
$result .= "\t\t
\n";
$menuItems = [
'Hjem' => '',
'Kalender' => 'kalender',
'Aktiviteter' => 'aktiviteter',
'Prosjekter' => 'prosjekt',
'Kontakt' => 'kontakt',
'Wiki' => 'pvv'
];
$as = new SimpleSAML_Auth_Simple($sp);
$attr = $as->getAttributes();
if($attr) {
$uname = $attr['uid'][0];
$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$userManager = new \pvv\admin\UserManager($pdo);
$isAdmin = $userManager->isAdmin($uname);
$projectGroup = $userManager->hasGroup($uname, 'prosjekt');
$activityGroup = $userManager->hasGroup($uname, 'aktiviteter');
if($isAdmin | $projectGroup | $activityGroup) {
$menuItems['Admin'] = 'admin';
}
}
foreach($menuItems as $caption => $link) {
$result .= "\t\t\t"
. "- " . $caption . "
\n"
;
}
$result .= "\t\t\t" . '☰' . "\n";
return $result . "\t\t
\n";
}
function loginBar($sp = 'default-sp') {
require_once __DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
$result = "\n";
$as = new SimpleSAML_Auth_Simple($sp);
$attr = $as->getAttributes();
if($attr) {
$uname = $attr['uid'][0];
$result .= "\t\tLogget inn som: " . htmlspecialchars($uname) . "
\n";
} else {
$result .= "\t\tgetLoginURL()) . "\">Logg inn\n";
}
return $result;
}