Author:   Lars Michelsen <[email protected]>
Date:     Sun Mar  4 19:32:14 2012 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sun Mar  4 19:32:14 2012 +0100

Fixed two auth db update bugs

---

 ChangeLog                                       |    3 ++
 share/server/core/classes/CoreModUrl.php        |    6 ++--
 share/server/core/classes/CoreMySQLHandler.php  |   24 +++++++++++++++++++++++
 share/server/core/classes/CoreSQLiteHandler.php |   24 +++++++++++++++++++++++
 4 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fa31fbc..77283e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 1.6.5
 Core
   * Bugfix: Fixed wrong variable in MySQL connect error handler
+  * Bugfix: Fixed bug in 1.6.1 auth db update scripts
+  * Bugfix: Added missing permission for the Url module which is used when
+            having URLs in rotations
 
 Frontend
   * Bugfix: Fixed cloning shape objects (view_type error message)
diff --git a/share/server/core/classes/CoreModUrl.php 
b/share/server/core/classes/CoreModUrl.php
index bd2d4f8..d643e2a 100644
--- a/share/server/core/classes/CoreModUrl.php
+++ b/share/server/core/classes/CoreModUrl.php
@@ -37,8 +37,8 @@ class CoreModUrl extends CoreModule {
 
         // Register valid actions
         $this->aActions = Array(
-            'getContents' => REQUIRES_AUTHORISATION,
-            'getProperties' => REQUIRES_AUTHORISATION
+            'getContents'   => 'view',
+            'getProperties' => 'view',
         );
     }
 
@@ -69,4 +69,4 @@ class CoreModUrl extends CoreModule {
         return $URL->parsePropertiesJson();
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/share/server/core/classes/CoreMySQLHandler.php 
b/share/server/core/classes/CoreMySQLHandler.php
index 6eb950a..25b5d3f 100644
--- a/share/server/core/classes/CoreMySQLHandler.php
+++ b/share/server/core/classes/CoreMySQLHandler.php
@@ -183,6 +183,25 @@ class CoreMySQLHandler {
         // Now perform the update for pre 1.6.1
         if($dbVersion < 1060100)
             $this->updateDb1060100();
+
+        // Now perform the update for pre 1.6.5
+        if($dbVersion < 1060500)
+            $this->updateDb1060500();
+    }
+
+    private function updateDb1060500() {
+       // Create permissions for Url/view/*
+        $this->query('INSERT INTO perms (`mod`, `act`, `obj`) VALUES (\'Url\', 
\'view\', \'*\')');
+        
+        // Assign the new permission to the managers, users, guests
+        $RES = $this->query('SELECT roleId FROM roles WHERE name=\'Managers\' 
or \'Users (read-only)\' or name=\'Guests\'');
+        while($data = $this->fetchAssoc($RES))
+            $this->addRolePerm($data['roleId'], 'Url', 'view', '*');
+
+        // Only apply the new version when this is the real release or newer
+        // (While development the version string remains on the old value)
+        if(GlobalCore::getInstance()->versionToTag(CONST_VERSION) >= 1060500)
+            $this->updateDbVersion();
     }
 
     private function updateDb1060100() {
@@ -206,6 +225,11 @@ class CoreMySQLHandler {
         foreach(GlobalCore::getInstance()->demoAutomaps AS $automap) {
             $this->addRolePerm($data['roleId'], 'AutoMap', 'view', $automap);
         }
+
+        // Only apply the new version when this is the real release or newer
+        // (While development the version string remains on the old value)
+        if(GlobalCore::getInstance()->versionToTag(CONST_VERSION) >= 1060100)
+            $this->updateDbVersion();
     }
 
     private function updateDb1060022() {
diff --git a/share/server/core/classes/CoreSQLiteHandler.php 
b/share/server/core/classes/CoreSQLiteHandler.php
index 96cf354..2c6475f 100644
--- a/share/server/core/classes/CoreSQLiteHandler.php
+++ b/share/server/core/classes/CoreSQLiteHandler.php
@@ -181,6 +181,25 @@ class CoreSQLiteHandler {
         // Now perform the update for pre 1.6.1
         if($dbVersion < 1060100)
             $this->updateDb1060100();
+
+        // Now perform the update for pre 1.6.5
+        if($dbVersion < 1060500)
+            $this->updateDb1060500();
+    }
+
+    private function updateDb1060500() {
+       // Create permissions for Url/view/*
+        $this->DB->query('INSERT INTO perms (mod, act, obj) VALUES (\'Url\', 
\'view\', \'*\')');
+        
+        // Assign the new permission to the managers, users, guests
+        $RES = $this->DB->query('SELECT roleId FROM roles WHERE 
name=\'Managers\' or \'Users (read-only)\' or name=\'Guests\'');
+        while($data = $this->fetchAssoc($RES))
+            $this->addRolePerm($data['roleId'], 'Url', 'view', '*');
+
+        // Only apply the new version when this is the real release or newer
+        // (While development the version string remains on the old value)
+        if(GlobalCore::getInstance()->versionToTag(CONST_VERSION) >= 1060500)
+            $this->updateDbVersion();
     }
 
     private function updateDb1060100() {
@@ -204,6 +223,11 @@ class CoreSQLiteHandler {
         foreach(GlobalCore::getInstance()->demoAutomaps AS $automap) {
             $this->addRolePerm($data['roleId'], 'AutoMap', 'view', $automap);
         }
+
+        // Only apply the new version when this is the real release or newer
+        // (While development the version string remains on the old value)
+        if(GlobalCore::getInstance()->versionToTag(CONST_VERSION) >= 1060100)
+            $this->updateDbVersion();
     }
 
     private function updateDb1060022() {


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to