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

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Sep 22 10:52:27 CEST 2010


Author: lolando
Date: 2010-09-22 10:52:27 +0200 (Wed, 22 Sep 2010)
New Revision: 10617

Modified:
   trunk/src/common/include/RBAC.php
   trunk/src/common/include/Role.class.php
   trunk/src/www/project/admin/users.php
Log:
PFO-RBAC: misc fixes

Modified: trunk/src/common/include/RBAC.php
===================================================================
--- trunk/src/common/include/RBAC.php	2010-09-22 08:48:15 UTC (rev 10616)
+++ trunk/src/common/include/RBAC.php	2010-09-22 08:52:27 UTC (rev 10617)
@@ -886,16 +886,25 @@
 		//
 		//	Cannot update role_id=1
 		//
-		if ($this->getID() == 1 && !USE_PFO_RBAC) {
-			$this->setError('Cannot Update Default Role');
-			return false;
-		}
-		if (!USE_PFO_RBAC) {
+		if (USE_PFO_RBAC) {
+			if ($this->Group == NULL
+			    && !forge_check_global_perm ('forge_admin')) {
+				$this->setPermissionDeniedError();
+				return false;
+			} elseif (!forge_check_perm ('project_admin', $this->Group->getID())) {
+				$this->setPermissionDeniedError();
+				return false;
+			}
+		} else {
 			$perm =& $this->Group->getPermission ();
 			if (!$perm || !is_object($perm) || $perm->isError() || !$perm->isAdmin()) {
 				$this->setPermissionDeniedError();
 				return false;
 			}
+			if ($this->getID() == 1) {
+				$this->setError('Cannot Update Default Role');
+				return false;
+			}
 		}
 
 		db_begin();

Modified: trunk/src/common/include/Role.class.php
===================================================================
--- trunk/src/common/include/Role.class.php	2010-09-22 08:48:15 UTC (rev 10616)
+++ trunk/src/common/include/Role.class.php	2010-09-22 08:52:27 UTC (rev 10617)
@@ -50,8 +50,8 @@
 				$this->setError('Role::'.$Group->getErrorMessage());
 				return false;
 			}
-			$this->Group =& $Group;
 		}
+		$this->Group =& $Group;
 
 		$hook_params = array ();
 		$hook_params['role'] =& $this;

Modified: trunk/src/www/project/admin/users.php
===================================================================
--- trunk/src/www/project/admin/users.php	2010-09-22 08:48:15 UTC (rev 10616)
+++ trunk/src/www/project/admin/users.php	2010-09-22 08:52:27 UTC (rev 10617)
@@ -235,7 +235,7 @@
 
 		echo '<form action="roleedit.php?group_id='. $group_id .'" method="post"><p>';
 		echo '<input type="text" name="role_name" size="10" value="" />';
-		echo '&nbsp;<input type="submit" name="add" value="'._("Add Role").'" /></p></form>';
+		echo '&nbsp;<input type="submit" name="add" value="'._("Create Role").'" /></p></form>';
 
 		echo $HTML->boxBottom();
 




More information about the Fusionforge-commits mailing list