Module: nagvis Branch: master Commit: 9320f047a80fae2ac90a32233e2ca4fda378d0a3 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=9320f047a80fae2ac90a32233e2ca4fda378d0a3
Author: Lars Michelsen <[email protected]> Date: Fri Oct 22 23:56:03 2010 +0200 #381 Added permission for the multisite webservice (all default roles are allowed by default) --- share/server/core/classes/CoreMySQLHandler.php | 32 +++++++++++++++++++++++ share/server/core/classes/CoreSQLiteHandler.php | 32 +++++++++++++++++++++++ 2 files changed, 64 insertions(+), 0 deletions(-) diff --git a/share/server/core/classes/CoreMySQLHandler.php b/share/server/core/classes/CoreMySQLHandler.php index 43726ad..b597ab6 100644 --- a/share/server/core/classes/CoreMySQLHandler.php +++ b/share/server/core/classes/CoreMySQLHandler.php @@ -171,6 +171,26 @@ class CoreMySQLHandler { // Now perform the update for pre 1.5.3 if($dbVersion < 1050300) $this->updateDb1050300(); + + // Now perform the update for pre 1.5.4 + if($dbVersion < 1050400) + $this->updateDb1050400(); + } + + private function updateDb1050400() { + // Create permissions for the multisite webservice + $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Multisite\', \'getMaps\', \'*\')'); + + // Assign the new permission to the managers + $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'], 'Multisite', 'getMaps', '*'); + } + + // 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) >= 1050400) + $this->updateDbVersion(); } private function updateDb1050300() { @@ -248,6 +268,9 @@ class CoreMySQLHandler { // Access controll: Change own password $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'ChangePassword\', \'change\', \'*\')'); + + // Access controll: View maps via multisite + $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Multisite\', \'getMaps\', \'*\')'); // Access controll: Search objects on maps $this->query('INSERT INTO perms (`mod`, `act`, obj) VALUES (\'Search\', \'view\', \'*\')'); @@ -335,6 +358,9 @@ class CoreMySQLHandler { // Access assignment: Managers => Allowed to change their passwords $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*'); + + // Access assignment: Managers => Allowed to view their maps via multisite + $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*'); // Access assignment: Managers => Allowed to search objects $this->addRolePerm($data['roleId'], 'Search', 'view', '*'); @@ -365,6 +391,9 @@ class CoreMySQLHandler { // Access assignment: Users => Allowed to change their passwords $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*'); + + // Access assignment: Users => Allowed to view their maps via multisite + $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*'); // Access assignment: Users => Allowed to search objects $this->addRolePerm($data['roleId'], 'Search', 'view', '*'); @@ -401,6 +430,9 @@ class CoreMySQLHandler { // Access assignment: Guests => Allowed to change their passwords $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*'); + + // Access assignment: Guests => Allowed to view their maps via multisite + $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*'); // Access assignment: Guests => Allowed to search objects $this->addRolePerm($data['roleId'], 'Search', 'view', '*'); diff --git a/share/server/core/classes/CoreSQLiteHandler.php b/share/server/core/classes/CoreSQLiteHandler.php index 8620776..1bfcd63 100644 --- a/share/server/core/classes/CoreSQLiteHandler.php +++ b/share/server/core/classes/CoreSQLiteHandler.php @@ -169,6 +169,26 @@ class CoreSQLiteHandler { // Now perform the update for pre 1.5.3 if($dbVersion < 1050300) $this->updateDb1050300(); + + // Now perform the update for pre 1.5.4 + if($dbVersion < 1050400) + $this->updateDb1050400(); + } + + private function updateDb1050400() { + // Create permissions for the multisite webservice + $this->DB->query('INSERT INTO perms (mod, act, obj) VALUES (\'Multisite\', \'getMaps\', \'*\')'); + + // 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'], 'Multisite', 'getMaps', '*'); + } + + // 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) >= 1050400) + $this->updateDbVersion(); } private function updateDb1050300() { @@ -270,6 +290,9 @@ class CoreSQLiteHandler { // Access controll: Change own password $this->DB->query('INSERT INTO perms (mod, act, obj) VALUES (\'ChangePassword\', \'change\', \'*\')'); + + // Access controll: View maps via multisite + $this->DB->query('INSERT INTO perms (mod, act, obj) VALUES (\'Multisite\', \'getMaps\', \'*\')'); // Access controll: Search objects on maps $this->DB->query('INSERT INTO perms (mod, act, obj) VALUES (\'Search\', \'view\', \'*\')'); @@ -357,6 +380,9 @@ class CoreSQLiteHandler { // Access assignment: Managers => Allowed to change their passwords $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*'); + + // Access assignment: Managers => Allowed to view their maps via multisite + $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*'); // Access assignment: Managers => Allowed to search objects $this->addRolePerm($data['roleId'], 'Search', 'view', '*'); @@ -387,6 +413,9 @@ class CoreSQLiteHandler { // Access assignment: Users => Allowed to change their passwords $this->addRolePerm($data['roleId'], 'ChangePassword', 'change', '*'); + + // Access assignment: Users => Allowed to view their maps via multisite + $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*'); // Access assignment: Users => Allowed to search objects $this->addRolePerm($data['roleId'], 'Search', 'view', '*'); @@ -408,6 +437,9 @@ class CoreSQLiteHandler { // Access assignment: Guests => Allowed to view the overview $this->addRolePerm($data['roleId'], 'Overview', 'view', '*'); + + // Access assignment: Guests => Allowed to view their maps via multisite + $this->addRolePerm($data['roleId'], 'Multisite', 'getMaps', '*'); // Access assignment: Guests => Allowed to view the demo, demo2, demo-map and demo-servers map $this->addRolePerm($data['roleId'], 'Map', 'view', 'demo'); ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
