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

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Jan 20 11:26:57 CET 2010


Author: lolando
Date: 2010-01-20 11:26:57 +0100 (Wed, 20 Jan 2010)
New Revision: 8675

Modified:
   trunk/gforge/common/include/SCMPlugin.class.php
   trunk/gforge/common/include/session.php
Log:
Fixed generation of SCM repositories for private projects

Modified: trunk/gforge/common/include/SCMPlugin.class.php
===================================================================
--- trunk/gforge/common/include/SCMPlugin.class.php	2010-01-19 21:37:03 UTC (rev 8674)
+++ trunk/gforge/common/include/SCMPlugin.class.php	2010-01-20 10:26:57 UTC (rev 8675)
@@ -68,15 +68,19 @@
 			$this->printShortStats ($params) ;
 			break;
 		case 'scm_create_repo':
+			session_set_admin () ;
 			$this->createOrUpdateRepo ($params) ;
 			break;
 		case 'scm_update_repolist':
+			session_set_admin () ;
 			$this->updateRepositoryList ($params) ;
 			break;
 		case 'scm_generate_snapshots': // Optional
+			session_set_admin () ;
 			$this->generateSnapshots ($params) ;
 			break;
 		case 'scm_gather_stats': // Optional
+			session_set_admin () ;
 			$this->gatherStats ($params) ;
 			break;
 		default:

Modified: trunk/gforge/common/include/session.php
===================================================================
--- trunk/gforge/common/include/session.php	2010-01-19 21:37:03 UTC (rev 8674)
+++ trunk/gforge/common/include/session.php	2010-01-20 10:26:57 UTC (rev 8675)
@@ -428,7 +428,30 @@
 
 }
 
+
 /**
+ *	session_set_admin() - Setup session for the admin user
+ *
+ *	This function sets up a session for the administrator
+ *
+ *	@return none
+ */
+function session_set_admin() {
+	$res = db_query_params ('SELECT user_id FROM user_group WHERE admin_flags=$1 AND group_id=1',
+				array ('A'));
+	if (!$res) {
+		echo db_error();
+		exit (1);
+	}
+	if (db_numrows($res) == 0) {
+		echo "No admin users?\n" ;
+		exit (1);
+	}
+	$id = db_result ($res, 0, 0);
+	session_set_new ($id);
+}
+
+/**
  *	Private optimization function for logins - fetches user data, language, and session
  *	with one query
  *




More information about the Fusionforge-commits mailing list