Only show buttons for admin pages you can access
This commit is contained in:
parent
ee42e932e9
commit
9241a0404a
|
@ -13,7 +13,11 @@ $as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!($userManager->isAdmin($uname) | $userManager->hasGroup($uname, 'prosjekt') | $userManager->hasGroup($uname, 'aktiviteter'))){
|
$isAdmin = $userManager->isAdmin($uname);
|
||||||
|
$projectGroup = $userManager->hasGroup($uname, 'prosjekt');
|
||||||
|
$activityGroup = $userManager->hasGroup($uname, 'aktiviteter');
|
||||||
|
|
||||||
|
if(!($isAdmin | $projectGroup | $activityGroup)){
|
||||||
echo 'Ingen tilgang';
|
echo 'Ingen tilgang';
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -31,8 +35,19 @@ if(!($userManager->isAdmin($uname) | $userManager->hasGroup($uname, 'prosjekt')
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<h2>Verktøy</h2>
|
<h2>Verktøy</h2>
|
||||||
<a class="btn adminbtn" href="aktiviteter/?page=1">Aktiviteter/Hendelser</a>
|
<?php
|
||||||
<a class="btn adminbtn" href="prosjekter/">Prosjekter</a>
|
if($isAdmin | $activityGroup){
|
||||||
|
echo '<a class="btn adminbtn" href="aktiviteter/?page=1">Aktiviteter/Hendelser</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($isAdmin | $projectGroup){
|
||||||
|
echo '<a class="btn adminbtn" href="prosjekter/">Prosjekter</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($isAdmin){
|
||||||
|
echo '<a class="btn adminbtn" href="brukere/">Brukere</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
Loading…
Reference in New Issue