[Fusionforge-commits] r9953 - trunk/gforge/common/include

Roland Mas lolando at libremir.placard.fr.eu.org
Fri May 28 19:13:08 CEST 2010


Author: lolando
Date: 2010-05-28 19:13:08 +0200 (Fri, 28 May 2010)
New Revision: 9953

Modified:
   trunk/gforge/common/include/Group.class.php
Log:
Convert Group::enableAnonSCM() and Group::SetUsesAnonSCM() to use the RBAC API

Modified: trunk/gforge/common/include/Group.class.php
===================================================================
--- trunk/gforge/common/include/Group.class.php	2010-05-28 17:05:21 UTC (rev 9952)
+++ trunk/gforge/common/include/Group.class.php	2010-05-28 17:13:08 UTC (rev 9953)
@@ -966,16 +966,26 @@
 	 *	@return boolean enable_scm.
 	 */
 	function enableAnonSCM() {
+		if (USE_PFO_RBAC) {
+			$r = RoleAnonymous::getInstance () ;
+			return $r->hasPermission ('scm', $this->getID(), 'read') ;
+		} else {
 		if ($this->isPublic() && $this->usesSCM()) {
 			return $this->data_array['enable_anonscm'];
 		} else {
 			return false;
 		}
+		}
 	}
 
 	function SetUsesAnonSCM ($booleanparam) {
 		db_begin () ;
 		$booleanparam = $booleanparam ? 1 : 0 ;
+		if (USE_PFO_RBAC) {
+			$r = RoleAnonymous::getInstance () ;
+			$r->setSetting ('scm', $this->getID(), $booleanparam) ;
+			db_commit () ;
+		} else {
 		$res = db_query_params ('UPDATE groups SET enable_anonscm=$1 WHERE group_id=$2',
 					array ($booleanparam, $this->getID()));
 		if ($res) {
@@ -985,6 +995,7 @@
 			db_rollback ();
 			return false;
 		}
+		}
 	}
 
 	function setUsesSCM ($booleanparam) {




More information about the Fusionforge-commits mailing list