[Fusionforge-commits] r9806 - in trunk/gforge/www: . scm scm/include

Roland Mas lolando at libremir.placard.fr.eu.org
Fri May 21 09:48:53 CEST 2010


Author: lolando
Date: 2010-05-21 09:48:53 +0200 (Fri, 21 May 2010)
New Revision: 9806

Modified:
   trunk/gforge/www/scm/include/scm_utils.php
   trunk/gforge/www/scm/viewvc.php
   trunk/gforge/www/snapshots.php
   trunk/gforge/www/tarballs.php
Log:
RBAC migration in progress

Modified: trunk/gforge/www/scm/include/scm_utils.php
===================================================================
--- trunk/gforge/www/scm/include/scm_utils.php	2010-05-21 07:48:41 UTC (rev 9805)
+++ trunk/gforge/www/scm/include/scm_utils.php	2010-05-21 07:48:53 UTC (rev 9806)
@@ -45,20 +45,19 @@
 		Show horizontal links
 	*/
 	if (session_loggedin()) {
-		$perm =& $project->getPermission ();
-		if ($perm && is_object($perm) && !$perm->isError() && $perm->isAdmin()) {
-				echo $HTML->subMenu(
+		if (forge_check_perm ('project_admin', $project->getID())) {
+			echo $HTML->subMenu(
 				array(
 					_('SCM'),
 					_('Admin'),
 					_('Reporting')
-				),
+					),
 				array(
 					'/scm/?group_id='.$params['group'],
 					'/scm/admin/?group_id='.$params['group'],
 					'/scm/reporting/?group_id='.$params['group']
-				)
-			);
+					)
+				);
 		}
 	}
 	echo '<div class="scm" style="width:99%">';

Modified: trunk/gforge/www/scm/viewvc.php
===================================================================
--- trunk/gforge/www/scm/viewvc.php	2010-05-21 07:48:41 UTC (rev 9805)
+++ trunk/gforge/www/scm/viewvc.php	2010-05-21 07:48:53 UTC (rev 9806)
@@ -56,16 +56,9 @@
 //$external_scm = (gethostbyname(forge_get_config('web_host')) != gethostbyname($scm_box)); 
 $external_scm = !$sys_scm_single_host;
 
-if (session_loggedin()) {
-	if (user_ismember($Group->getID())) {
-		$perm = & $Group->getPermission ();
-		
-		if (!($perm && is_object($perm) && $perm->isCVSReader()) && !$Group->enableAnonSCM()) {
-			exit_permission_denied();
-		}
-	} else if (!$Group->enableAnonSCM()) {
-		exit_permission_denied();
-	}
+if (!forge_check_perm ('scm', $group->getID(), 'read')) {
+	exit_permission_denied();
+}
 	
 } else if (!$Group->enableAnonSCM()) {		// user is not logged in... check if group accepts anonymous CVS
 	exit_permission_denied();
@@ -143,4 +136,9 @@
 	echo $content;
 }
 
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
 ?>

Modified: trunk/gforge/www/snapshots.php
===================================================================
--- trunk/gforge/www/snapshots.php	2010-05-21 07:48:41 UTC (rev 9805)
+++ trunk/gforge/www/snapshots.php	2010-05-21 07:48:53 UTC (rev 9806)
@@ -27,16 +27,8 @@
 		$group->getErrorMessage());
 }
 
-// Snapshot can be downloaded only if anon SCM is enabled or if the
-// logged in user belongs the group
-$permission = $group->enableAnonSCM();
-if(session_loggedin()) {
-	$perm =& $group->getPermission ();
- 	if ($perm && is_object($perm) && !$perm->isError() && $perm->isMember()) {
- 		$permission = true;
- 	}
-}
-if (!$permission) {
+// Snapshot downloads require the same permissions as SCM read access
+if (!forge_check_perm ('scm', $group->getID(), 'read')) {
  	exit_permission_denied();
 }
 

Modified: trunk/gforge/www/tarballs.php
===================================================================
--- trunk/gforge/www/tarballs.php	2010-05-21 07:48:41 UTC (rev 9805)
+++ trunk/gforge/www/tarballs.php	2010-05-21 07:48:53 UTC (rev 9806)
@@ -28,13 +28,9 @@
 		$group->getErrorMessage());
 }
 
-$perm =& $group->getPermission ();
-if (!$perm || !is_object($perm)) {
-	exit_error(_('Error'),
-		_('Error creating permission'));
-} else if ($perm->isError()) {
-	exit_error(_('Error'),
-		$perm->getErrorMessage());
+// Tarball downloads require the same permissions as SCM read access
+if (!forge_check_perm ('scm', $group->getID(), 'read')) {
+ 	exit_permission_denied();
 }
 
 $group_name=$group->getUnixName();




More information about the Fusionforge-commits mailing list