2017-10-28 17:19:40 +02:00
|
|
|
<?php
|
2018-02-13 19:10:15 +01:00
|
|
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
2017-11-11 17:06:56 +01:00
|
|
|
|
2024-03-12 19:33:09 +01:00
|
|
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
2017-11-11 17:06:56 +01:00
|
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$userManager = new \pvv\admin\UserManager($pdo);
|
|
|
|
|
2024-04-08 22:11:43 +02:00
|
|
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
2017-11-11 17:06:56 +01:00
|
|
|
$as->requireAuth();
|
2017-10-28 17:19:40 +02:00
|
|
|
$attrs = $as->getAttributes();
|
2017-11-11 17:06:56 +01:00
|
|
|
$uname = $attrs['uid'][0];
|
|
|
|
|
2017-11-11 17:21:04 +01:00
|
|
|
$isAdmin = $userManager->isAdmin($uname);
|
|
|
|
$projectGroup = $userManager->hasGroup($uname, 'prosjekt');
|
|
|
|
$activityGroup = $userManager->hasGroup($uname, 'aktiviteter');
|
|
|
|
|
|
|
|
if(!($isAdmin | $projectGroup | $activityGroup)){
|
2018-02-13 18:30:49 +01:00
|
|
|
header('Content-Type: text/plain', true, 403);
|
|
|
|
echo "Her har du ikke lov't'å'værra!!!\r\n";
|
2017-11-11 17:06:56 +01:00
|
|
|
exit();
|
|
|
|
}
|
2017-10-28 17:19:40 +02:00
|
|
|
?>
|
2018-08-10 00:20:03 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="no">
|
2018-08-14 02:09:32 +02:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
|
|
|
<link rel="shortcut icon" href="favicon.ico">
|
|
|
|
<link rel="stylesheet" href="../css/normalize.css">
|
|
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
|
|
<link rel="stylesheet" href="../css/events.css">
|
|
|
|
<link rel="stylesheet" href="../css/admin.css">
|
2018-08-14 03:29:10 +02:00
|
|
|
<meta name="theme-color" content="#024" />
|
2018-08-14 02:09:32 +02:00
|
|
|
<title>Administrasjonsverkstedet</title>
|
|
|
|
|
|
|
|
<header>Administrasjons­verk­stedet</header>
|
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
|
|
|
|
<body>
|
|
|
|
<nav id="navbar">
|
|
|
|
<?php echo navbar(1, 'admin'); ?>
|
2018-02-24 16:53:17 +01:00
|
|
|
<?php echo loginbar(null, $pdo); ?>
|
2018-02-10 16:13:18 +01:00
|
|
|
</nav>
|
|
|
|
|
|
|
|
<main>
|
2018-08-14 02:09:32 +02:00
|
|
|
<h2>Administrasjon</h2>
|
2018-02-10 16:13:18 +01:00
|
|
|
<ul class="tools">
|
|
|
|
<?php
|
|
|
|
if($isAdmin | $activityGroup){
|
|
|
|
echo '<li><a class="btn" href="aktiviteter/?page=1">Aktiviteter/Hendelser</a></li>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if($isAdmin | $projectGroup){
|
|
|
|
echo '<li><a class="btn" href="prosjekter/">Prosjekter</a></li>';
|
|
|
|
}
|
|
|
|
|
2018-02-13 16:58:54 +01:00
|
|
|
if($isAdmin) {
|
|
|
|
echo '<li><a class="btn" href="motd/">Dagens melding</a></li>';
|
|
|
|
}
|
|
|
|
|
2018-02-10 16:13:18 +01:00
|
|
|
if($isAdmin){
|
2018-08-09 22:28:34 +02:00
|
|
|
echo '<li><a class="btn" href="brukere/">Brukerrettigheter</a></li>';
|
2018-02-10 16:13:18 +01:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<ul>
|
|
|
|
</main>
|
2018-02-24 16:53:17 +01:00
|
|
|
</body>
|