Module: nagvis
Branch: master
Commit: 1e60d87f4f8d9e8cf6bf928e76e126b5795d7437
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=1e60d87f4f8d9e8cf6bf928e76e126b5795d7437

Author: Lars Michelsen <[email protected]>
Date:   Sat May  1 17:10:54 2010 +0200

#276 Hide the overview link when not permitted to access the overview page

---

 docs/en_US/header_templates.html                   |    3 +++
 .../nagvis-js/classes/NagVisHeaderMenu.php         |    8 +++++---
 share/userfiles/templates/default.header.html      |    4 +++-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/docs/en_US/header_templates.html b/docs/en_US/header_templates.html
index cb73ed5..ff121a8 100644
--- a/docs/en_US/header_templates.html
+++ b/docs/en_US/header_templates.html
@@ -41,6 +41,9 @@
                <td>{$bRotation}</td><td>Is true when currently viewing a 
rotation. Otherwise it is False. <font color="#ff0000">(New in 1.5)</font>.</td>
                </tr>
                <tr>
+               <td>{$permittedOverview}</td><td>Is true when the user is 
permitted to access the overview page. Otherwise it is False. <font 
color="#ff0000">(New in 1.5)</font>.</td>
+               </tr>
+               <tr>
                <td>{$permittedEdit}</td><td>Is true when the user is permitted 
to edit the current map. Otherwise it is False. <font color="#ff0000">(New in 
1.5)</font>.</td>
                </tr>
                <tr>
diff --git a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php 
b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
index 42d7c5d..a500675 100644
--- a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
+++ b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
@@ -107,6 +107,8 @@ class NagVisHeaderMenu {
                // In rotation?
                $this->aMacros['bRotation'] = $this->bRotation;
                
+               $this->aMacros['permittedOverview'] = 
$this->CORE->getAuthorization() !== null && 
$this->CORE->getAuthorization()->isPermitted('Overview', 'view', '*');
+               
                // Check if the user is permitted to edit the current 
map/automap
                $this->aMacros['permittedView'] = 
$this->CORE->getAuthorization() !== null && 
$this->CORE->getAuthorization()->isPermitted($this->aMacros['mod'], 'view', 
$this->UHANDLER->get('show'));
                $this->aMacros['permittedEdit'] = 
$this->CORE->getAuthorization() !== null && 
$this->CORE->getAuthorization()->isPermitted($this->aMacros['mod'], 'edit', 
$this->UHANDLER->get('show'));
@@ -129,7 +131,7 @@ class NagVisHeaderMenu {
                
                
                // Build map list
-               $permEditAnyMap = True;
+               $permEditAnyMap = False;
                $aMaps = Array();
                foreach($this->CORE->getAvailableMaps() AS $mapName) {
                        $map = Array();
@@ -156,7 +158,7 @@ class NagVisHeaderMenu {
                        $map['urlParams'] = '';
                        $map['permittedEdit'] = 
$this->CORE->getAuthorization()->isPermitted('Map', 'edit', $mapName);
 
-                       $permEditAnyMap &= $map['permittedEdit'];
+                       $permEditAnyMap |= $map['permittedEdit'];
                        
                        // auto select current map
                        $map['selected'] = ($this->OBJ !== null && 
($this->aMacros['mod'] == 'Map' || $this->aMacros['mod'] == 'AutoMap') && 
$mapName == $this->OBJ->getName());
@@ -165,7 +167,7 @@ class NagVisHeaderMenu {
                }
                
                $this->aMacros['maps'] = $aMaps;
-               $this->aMacros['permissionEditAnyMap'] = $permEditAnyMap; 
+               $this->aMacros['permittedEditAnyMap'] = $permEditAnyMap; 
                
                // Build automap list
                $aAutomaps = Array();
diff --git a/share/userfiles/templates/default.header.html 
b/share/userfiles/templates/default.header.html
index 5f16d32..861298b 100644
--- a/share/userfiles/templates/default.header.html
+++ b/share/userfiles/templates/default.header.html
@@ -7,8 +7,10 @@
                        <dt id="views-ddheader" onmouseover="ddMenu('views',1)" 
onmouseout="ddMenu('views',-1)">{$langOpen} <img 
src="{$pathTemplateImages}default.header_down.png" alt="&#8711;" /></dt>
                        <dd id="views-ddcontent" 
onmouseover="cancelHide('views')" onmouseout="ddMenu('views',-1)">
                                <ul>
+                                       {if $permittedOverview}
                                        <li><a 
href="{$pathBase}/frontend/nagvis-js/index.php">{$langOverview}</a></li>
                                        <li class="spacer"><hr /></li>
+                                       {/if}
                                        {if count($maps) > 0}
                                        {foreach $maps map}<li>
                                                {if $map.configError == true}
@@ -31,7 +33,7 @@
                                                <li class="spacer"><hr /></li>
                                        {/foreach}
                                        {/if}
-                                       {if $permissionEditAnyMap}
+                                       {if $permittedEditAnyMap}
                                        <li><a 
href="{$pathBase}/frontend/wui/index.php" class="underline">{$langWui}</a></li>
                                        {else}
                                        <li class="spacer underline"></li>


------------------------------------------------------------------------------
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to