[Fusionforge-commits] r12496 - trunk/src/common/include

Olivier Berger olberger at fusionforge.org
Tue Mar 1 21:57:33 CET 2011


Author: olberger
Date: 2011-03-01 21:57:33 +0100 (Tue, 01 Mar 2011)
New Revision: 12496

Modified:
   trunk/src/common/include/User.class.php
Log:
Support passing group_id and make it a bit more explicit for debugging purposes

Modified: trunk/src/common/include/User.class.php
===================================================================
--- trunk/src/common/include/User.class.php	2011-03-01 20:57:21 UTC (rev 12495)
+++ trunk/src/common/include/User.class.php	2011-03-01 20:57:33 UTC (rev 12496)
@@ -1527,12 +1527,20 @@
 	 * @param	object	group object
 	 * @return	object	Role object
 	 */
-	function getRole(&$group) {
+	function getRole(&$g) {
+		if (is_int ($g) || is_string($g)) {
+			$group_id = $g;
+		} else {
+			$group_id = $g->getID();
+		}
 		foreach ($this->getRoles () as $r) {
-			if ($r instanceof RoleExplicit
-			    && $r->getHomeProject() != NULL
-			    && $r->getHomeProject()->getID() == $group->getID()) {
-				return $r;
+			if ($r instanceof RoleExplicit ) {
+				$homeproj = $r->getHomeProject();
+				if ($homeproj) {
+					if ($homeproj->getID() == $group_id) {
+						return $r;
+					}
+				}
 			}
 		}
 		return false;




More information about the Fusionforge-commits mailing list