Author:   Lars Michelsen <[email protected]>
Date:     Mon Jun  9 19:08:27 2014 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Mon Jun  9 19:08:27 2014 +0200

Deleting no longer required map permission entries before rendering the manage 
roles dialog

---

 ChangeLog                                          |    4 ++++
 .../core/classes/CoreAuthorisationHandler.php      |   14 ++++++++++++++
 .../server/core/classes/NagVisViewManageRoles.php  |    5 +++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 00f3a29..1d1b351 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@ Frontend:
     (Thanks to [email protected] for the patch)
   * FIX: Fixed links of rotation steps (always linking to last step)
 
+Core:
+  * FIX: Deleting no longer required map permission entries (e.g. of maps 
deleted
+  by hand) before rendering the manage roles dialog
+
 1.8b4
 Frontend:
   * Multisite snapin now transports downtime / acknowledgement information
diff --git a/share/server/core/classes/CoreAuthorisationHandler.php 
b/share/server/core/classes/CoreAuthorisationHandler.php
index 13982f8..3990a76 100644
--- a/share/server/core/classes/CoreAuthorisationHandler.php
+++ b/share/server/core/classes/CoreAuthorisationHandler.php
@@ -162,6 +162,20 @@ class CoreAuthorisationHandler {
         return strcmp($a['mod'].$a['obj'].$a['act'], 
$b['mod'].$b['obj'].$b['act']);
     }
 
+    public function cleanupPermissions() {
+        global $CORE;
+
+        // loop all map related permissions and check whether or not the map
+        // is still available
+        foreach ($this->getAllVisiblePerms() AS $perm) {
+            if ($perm['mod'] == 'Map' && $perm['obj'] != '*') {
+                if(count($CORE->getAvailableMaps('/^'.$perm['obj'].'$/')) <= 
0) {
+                    $this->deletePermission('Map', $perm['obj']);
+                }
+            }
+        }
+    }
+
     public function getAllVisiblePerms() {
         $aReturn = Array();
         // FIXME: First check if this is supported
diff --git a/share/server/core/classes/NagVisViewManageRoles.php 
b/share/server/core/classes/NagVisViewManageRoles.php
index 28d062f..5b86bee 100644
--- a/share/server/core/classes/NagVisViewManageRoles.php
+++ b/share/server/core/classes/NagVisViewManageRoles.php
@@ -38,6 +38,11 @@ class NagVisViewManageRoles {
         $TMPL = New CoreTemplateSystem($CORE);
         $TMPLSYS = $TMPL->getTmplSys();
 
+        // Delete permissions, which are not needed anymore when opening the
+        // "manage roles" dialog. This could be done during usual page
+        // processing, but would add overhead which is not really needed.
+        $AUTHORISATION->cleanupPermissions();
+
         $aData = Array(
             'htmlBase' => cfg('paths', 'htmlbase'),
             'formTargetAdd' => 
cfg('paths','htmlbase').'/server/core/ajax_handler.php?mod=RoleMgmt&amp;act=doAdd',


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to