[Fusionforge-commits] r9835 - trunk/gforge/common/include

Roland Mas lolando at libremir.placard.fr.eu.org
Fri May 21 09:56:17 CEST 2010


Author: lolando
Date: 2010-05-21 09:56:17 +0200 (Fri, 21 May 2010)
New Revision: 9835

Modified:
   trunk/gforge/common/include/Group.class.php
   trunk/gforge/common/include/RBAC.php
Log:
Switch between PFO/old RBAC in a few more places

Modified: trunk/gforge/common/include/Group.class.php
===================================================================
--- trunk/gforge/common/include/Group.class.php	2010-05-21 07:56:03 UTC (rev 9834)
+++ trunk/gforge/common/include/Group.class.php	2010-05-21 07:56:17 UTC (rev 9835)
@@ -2435,8 +2435,13 @@
 		
 		$rolesId = Array();
 		
-		$roles_group_res = db_query_params ('SELECT role_id FROM role WHERE group_id=$1',
-					array ($this->getID()));
+		if (USE_PFO_RBAC) {
+			$roles_group_res = db_query_params ('SELECT role_id FROM pfo_role WHERE home_group_id=$1',
+							    array ($this->getID()));
+		} else {
+			$roles_group_res = db_query_params ('SELECT role_id FROM role WHERE group_id=$1',
+							    array ($this->getID()));
+		}
 		if (!$roles_group_res) {
 			$this->setError('Error: Roles from group id '. $this->getID() . ' ' .db_error());
 			return false;

Modified: trunk/gforge/common/include/RBAC.php
===================================================================
--- trunk/gforge/common/include/RBAC.php	2010-05-21 07:56:03 UTC (rev 9834)
+++ trunk/gforge/common/include/RBAC.php	2010-05-21 07:56:17 UTC (rev 9835)
@@ -70,19 +70,19 @@
 		unset($this->setting_array);
 		unset($this->perms_array);
 
-		$res = db_query_params ('SELECT * FROM role WHERE role_id=$1',
-					array ($role_id)) ;
-		if (!$res || db_numrows($res) < 1) {
-			$this->setError('Role::fetchData()::'.db_error());
-			return false;
-		}
-		$this->data_array =& db_fetch_array($res);
-
 		if (USE_PFO_RBAC) {
-			$res = db_query_params ('SELECT section, reference, value FROM role_perms WHERE role_id=$1',
+			$res = db_query_params ('SELECT * FROM pfo_role WHERE role_id=$1',
 						array ($role_id)) ;
+			if (!$res || db_numrows($res) < 1) {
+				$this->setError('BaseRole::fetchData()::'.db_error());
+				return false;
+			}
+			$this->data_array =& db_fetch_array($res);
+			
+			$res = db_query_params ('SELECT section, reference, value FROM pfo_role_setting WHERE role_id=$1',
+						array ($role_id)) ;
 			if (!$res) {
-				$this->setError('Role::fetchData()::'.db_error());
+				$this->setError('BaseRole::fetchData()::'.db_error());
 				return false;
 			}
 			$this->perms_array=array();
@@ -90,11 +90,19 @@
 				$this->perms_array[$arr['section']][$arr['reference']] = $arr['value'];
 			}
 		} else {
+			$res = db_query_params ('SELECT * FROM role WHERE role_id=$1',
+						array ($role_id)) ;
+			if (!$res || db_numrows($res) < 1) {
+				$this->setError('BaseRole::fetchData()::'.db_error());
+				return false;
+			}
+			$this->data_array =& db_fetch_array($res);
+
 			// Load pre-PFO RBAC settings...
 			$res = db_query_params ('SELECT * FROM role_setting WHERE role_id=$1',
 						array ($role_id)) ;
 			if (!$res) {
-				$this->setError('Role::fetchData()::'.db_error());
+				$this->setError('BaseRole::fetchData()::'.db_error());
 				return false;
 			}
 			$this->setting_array=array();




More information about the Fusionforge-commits mailing list