[Fusionforge-commits] r11829 - branches/Branch_5_1/src/common/include

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Dec 17 18:04:15 CET 2010


Author: lolando
Date: 2010-12-17 18:04:15 +0100 (Fri, 17 Dec 2010)
New Revision: 11829

Modified:
   branches/Branch_5_1/src/common/include/Role.class.php
Log:
When creating a new project-local role, propagate its new_{tracker,pm,forum} permissions to the existing trackers etc.

Modified: branches/Branch_5_1/src/common/include/Role.class.php
===================================================================
--- branches/Branch_5_1/src/common/include/Role.class.php	2010-12-17 15:15:07 UTC (rev 11828)
+++ branches/Branch_5_1/src/common/include/Role.class.php	2010-12-17 17:04:15 UTC (rev 11829)
@@ -316,11 +316,12 @@
 		} else {
 			$arr = array () ;
 		}
-		$keys = array_keys($arr);
+
 		$data = array();
-		for ($i=0; $i<count($keys); $i++) {
+		foreach ($arr as $k => $v) {
+			$data[$k][$this->Group->getID()]= $v;
 
-			if ($keys[$i] == 'forum') {
+			if ($k == 'new_forum') {
 				$res = db_query_params ('SELECT group_forum_id FROM forum_group_list WHERE group_id=$1',
 							array ($this->Group->getID())) ;
 				if (!$res) {
@@ -328,9 +329,9 @@
 					return false;
 				}
 				for ($j=0; $j<db_numrows($res); $j++) {
-					$data[$keys[$i]][db_result($res,$j,'group_forum_id')]= $arr[$keys[$i]];
+					$data['forum'][db_result($res,$j,'group_forum_id')]= $v;
 				}
-			} elseif ($keys[$i] == 'pm') {
+			} elseif ($k == 'new_pm') {
 				$res = db_query_params ('SELECT group_project_id FROM project_group_list WHERE group_id=$1',
 							array ($this->Group->getID())) ;
 				if (!$res) {
@@ -338,9 +339,9 @@
 					return false;
 				}
 				for ($j=0; $j<db_numrows($res); $j++) {
-					$data[$keys[$i]][db_result($res,$j,'group_project_id')]= $arr[$keys[$i]];
+					$data['pm'][db_result($res,$j,'group_project_id')]= $v;
 				}
-			} elseif ($keys[$i] == 'tracker') {
+			} elseif ($k == 'new_tracker') {
 				$res = db_query_params ('SELECT group_artifact_id FROM artifact_group_list WHERE group_id=$1',
 							array ($this->Group->getID())) ;
 				if (!$res) {
@@ -348,10 +349,8 @@
 					return false;
 				}
 				for ($j=0; $j<db_numrows($res); $j++) {
-					$data[$keys[$i]][db_result($res,$j,'group_artifact_id')]= $arr[$keys[$i]];
+					$data['tracker'][db_result($res,$j,'group_artifact_id')]= $v;
 				}
-			} else {
-				$data[$keys[$i]][0]= $arr[$keys[$i]];
 			}
 		}
 




More information about the Fusionforge-commits mailing list