[Fusionforge-commits] r10543 - in trunk/src: common/include www/project/admin

Roland Mas lolando at libremir.placard.fr.eu.org
Sat Sep 18 20:52:51 CEST 2010


Author: lolando
Date: 2010-09-18 20:52:51 +0200 (Sat, 18 Sep 2010)
New Revision: 10543

Modified:
   trunk/src/common/include/RBAC.php
   trunk/src/www/project/admin/roleedit.php
Log:
Make code match better with logic when determining role settings for a project

Modified: trunk/src/common/include/RBAC.php
===================================================================
--- trunk/src/common/include/RBAC.php	2010-09-18 18:34:09 UTC (rev 10542)
+++ trunk/src/common/include/RBAC.php	2010-09-18 18:52:51 UTC (rev 10543)
@@ -481,12 +481,7 @@
 		$group_id = $project->getID() ;
 
 		if (USE_PFO_RBAC) {
-			$sections = array_keys ($this->role_values) ;			
-			foreach ($sections as $section) {
-				if (!in_array ($section, $this->global_settings)) {
-					$result[$section][$group_id] = $this->getVal ($section, $group_id) ;
-				}
-			}
+			$sections = array ('project_read', 'project_admin', 'frs', 'scm', 'docman', 'tracker_admin', 'new_tracker', 'forum_admin', 'new_forum', 'pm_admin', 'new_pm', 'webcal') ;
 		} else {
 			$sections = array ('projectadmin', 'frs', 'scm', 'docman', 'trackeradmin', 'newtracker', 'forumadmin', 'newforum', 'pmadmin', 'newpm', 'webcal') ;
 			foreach ($sections as $section) {
@@ -512,6 +507,23 @@
 			$result['tracker'][$pgid] = $this->getVal ('pm', $pgid) ;
 		}
 
+		if (USE_PFO_RBAC) {
+			// Add settings not yet listed so far (probably plugins)
+			// Currently handled:
+			// - global settings (ignored here)
+			// - project-wide settings (core and plugins)
+			// - settings for multiple-instance tools coming from the core (trackers/pm/forums)
+			// TODO:
+			// - settings for multiple-instance tools from plugins
+			foreach (array_keys ($this->role_values) as $s) {
+				if (!in_array ($s, $sections)) {
+					if (!in_array ($section, $this->global_settings)) {
+						$result[$section][$group_id] = $this->getVal ($section, $group_id) ;
+					}
+				}
+			}
+		}
+
 		return $result ;
 	}
 

Modified: trunk/src/www/project/admin/roleedit.php
===================================================================
--- trunk/src/www/project/admin/roleedit.php	2010-09-18 18:34:09 UTC (rev 10542)
+++ trunk/src/www/project/admin/roleedit.php	2010-09-18 18:52:51 UTC (rev 10543)
@@ -180,8 +180,8 @@
 //	Everything is built on the multi-dimensial arrays in the Role object
 //
 $j = 0;
-$keys = array_keys($role->role_values);
 if (USE_PFO_RBAC) {
+	$keys = array_keys($role->getSettingsForProject ($group)) ;
 	$keys2 = array () ;
 	foreach ($keys as $key) {
 		if (!in_array ($key, $role->global_settings)) {
@@ -189,6 +189,8 @@
 		}
 	}
 	$keys = $keys2 ;
+} else {
+	$keys = array_keys($role->role_values);
 }
 for ($i=0; $i<count($keys); $i++) {
         if ((!$group->usesForum() && preg_match("/forum/", $keys[$i])) ||
@@ -337,4 +339,9 @@
 
 project_admin_footer(array());
 
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>




More information about the Fusionforge-commits mailing list