Author:   Lars Michelsen <[email protected]>
Date:     Thu Aug 21 10:22:26 2014 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Thu Aug 21 10:22:26 2014 +0200

Multisite Authorisation: It is now possible to specific manage map view/edit 
permissions

---

 ChangeLog                                          |    3 ++
 .../core/classes/CoreAuthorisationModMultisite.php |   26 ++++++++++++-------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 878abaf..1a1252c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 Frontend:
   * FIX: The zoombar is now rendered below the header menu layer
 
+Core:
+  * Multisite Authorisation: It is now possible to specific manage map 
view/edit permissions
+
 1.8b6:
 Geomap:
   * Geomaps support multiple backends as object source now
diff --git a/share/server/core/classes/CoreAuthorisationModMultisite.php 
b/share/server/core/classes/CoreAuthorisationModMultisite.php
index 986c5c6..b7ce15d 100644
--- a/share/server/core/classes/CoreAuthorisationModMultisite.php
+++ b/share/server/core/classes/CoreAuthorisationModMultisite.php
@@ -56,18 +56,24 @@ class CoreAuthorisationModMultisite extends 
CoreAuthorisationModule {
             array('Multisite', 'getMaps',            '*'),
         );
 
-        $nagvis_permissions = array(
-            array('*',        '*',      '*'),
-            array('Map',      'view',   '*'),
-            array('Map',      'edit',   '*'),
-            array('Map',      'delete', '*'),
-            array('Rotation', 'view',   '*'),
-        );
+        # Gather NagVis related permissions
+        $nagvis_permissions = array();
+        global $mk_roles;
+        foreach ($mk_roles AS $role_id => $permissions) {
+            foreach ($permissions AS $perm_id) {
+                if (strpos($perm_id, 'nagvis.') === 0) {
+                    $key = substr($perm_id, 7);
+                    if (!isset($nagvis_permissions[$key])) {
+                        $nagvis_permissions[$key] = null;
+                    }
+                }
+            }
+        }
 
         # Loop the multisite NagVis related permissions and add them
-        foreach($nagvis_permissions AS $p) {
-            if(may($username, 'nagvis.'.implode('_', $p))) {
-                $perms[] = $p;
+        foreach($nagvis_permissions AS $p => $_unused) {
+            if(may($username, 'nagvis.'.$p)) {
+                $perms[] = explode('_', $p);
             }    
         }
 


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to