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

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Sep 21 15:45:35 CEST 2010


Author: lolando
Date: 2010-09-21 15:45:34 +0200 (Tue, 21 Sep 2010)
New Revision: 10592

Modified:
   trunk/src/common/include/Group.class.php
   trunk/src/common/include/RBAC.php
   trunk/src/common/include/Role.class.php
   trunk/src/www/project/admin/roleedit.php
Log:
Many RBAC fixes

Modified: trunk/src/common/include/Group.class.php
===================================================================
--- trunk/src/common/include/Group.class.php	2010-09-21 12:39:25 UTC (rev 10591)
+++ trunk/src/common/include/Group.class.php	2010-09-21 13:45:34 UTC (rev 10592)
@@ -2224,6 +2224,14 @@
 			}
 		}
 
+		if (USE_PFO_RBAC) {
+			$roles = $this->getRoles() ;
+			foreach ($roles as $r) {
+				if ($r->getSetting ('project_admin', $this->getID())) {
+					$r->addUser (user_get_object ($idadmin_group)) ;
+				}
+			}
+		}
 
 		//
 		//

Modified: trunk/src/common/include/RBAC.php
===================================================================
--- trunk/src/common/include/RBAC.php	2010-09-21 12:39:25 UTC (rev 10591)
+++ trunk/src/common/include/RBAC.php	2010-09-21 13:45:34 UTC (rev 10592)
@@ -482,6 +482,9 @@
 
 		if (USE_PFO_RBAC) {
 			$sections = array ('project_read', 'project_admin', 'frs', 'scm', 'docman', 'tracker_admin', 'new_tracker', 'forum_admin', 'new_forum', 'pm_admin', 'new_pm', 'webcal') ;
+			foreach ($sections as $section) {
+				$result[$section][$group_id] = $this->getVal ($section, $group_id) ;
+			}
 		} else {
 			$sections = array ('projectadmin', 'frs', 'scm', 'docman', 'trackeradmin', 'newtracker', 'forumadmin', 'newforum', 'pmadmin', 'newpm', 'webcal') ;
 			foreach ($sections as $section) {
@@ -504,9 +507,10 @@
 		$pgf = new ProjectGroupFactory ($project) ;
 		$pgids = $pgf->getAllProjectGroupIds () ;
 		foreach ($pgids as $pgid) {
-			$result['tracker'][$pgid] = $this->getVal ('pm', $pgid) ;
+			$result['pm'][$pgid] = $this->getVal ('pm', $pgid) ;
 		}
 
+
 		if (USE_PFO_RBAC) {
 			// Add settings not yet listed so far (probably plugins)
 			// Currently handled:
@@ -515,8 +519,8 @@
 			// - 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)) {
+			foreach (array_keys ($this->perms_array) as $section) {
+				if (!in_array ($section, $sections)) {
 					if (!in_array ($section, $this->global_settings)) {
 						$result[$section][$group_id] = $this->getVal ($section, $group_id) ;
 					}

Modified: trunk/src/common/include/Role.class.php
===================================================================
--- trunk/src/common/include/Role.class.php	2010-09-21 12:39:25 UTC (rev 10591)
+++ trunk/src/common/include/Role.class.php	2010-09-21 13:45:34 UTC (rev 10592)
@@ -376,6 +376,8 @@
 		} elseif (array_key_exists ($this->data_array['role_name'], $this->defaults)
 			  && array_key_exists ($section, $this->defaults[$this->data_array['role_name']])) {
 			$new_pa[$section][$refid] = $this->defaults[$this->data_array['role_name']][$section] ;
+		} else {
+			$new_pa[$section][$refid] = 0 ;
 		}
 		return $new_pa ;
 	}
@@ -492,8 +494,11 @@
 		}
 		
 		// Save
-		$this->update ($this->data_array['role_name'], $new_sa) ;
-
+		if (USE_PFO_RBAC) {
+			$this->update ($this->data_array['role_name'], $new_pa) ;
+		} else {
+			$this->update ($this->data_array['role_name'], $new_sa) ;
+		}
 		return true;
 	}
 

Modified: trunk/src/www/project/admin/roleedit.php
===================================================================
--- trunk/src/www/project/admin/roleedit.php	2010-09-21 12:39:25 UTC (rev 10591)
+++ trunk/src/www/project/admin/roleedit.php	2010-09-21 13:45:34 UTC (rev 10592)
@@ -78,6 +78,10 @@
 
 	$old_data = $role->getSettingsForProject ($group) ;
 	$new_data = array () ;
+
+	if (!is_array ($data)) {
+		$data = array () ;
+	}
 	foreach ($old_data as $section => $values) {
 		if (!array_key_exists ($section, $data)) {
 			continue ;
@@ -90,7 +94,6 @@
 		}
 	}
 	$data = $new_data ;
-
 	if (getStringFromRequest('submit')) {
 		if (($role->getHomeProject() != NULL)
 		    && ($role->getHomeProject()->getID() == $group_id)) {




More information about the Fusionforge-commits mailing list