[evolvis-commits] r18249: let populate_template_project use the “admin” user, not _any_ admin

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Apr 5 23:02:07 CEST 2012


Author: mirabilos
Date: 2012-04-05 23:02:07 +0200 (Thu, 05 Apr 2012)
New Revision: 18249

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/include/session.php
Log:
let populate_template_project use the “admin” user, not _any_ admin


Modified: trunk/gforge_base/evolvisforge-5.1/src/common/include/session.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/include/session.php	2012-04-05 21:02:01 UTC (rev 18248)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/include/session.php	2012-04-05 21:02:07 UTC (rev 18249)
@@ -566,7 +566,19 @@
 	if (count ($admins) == 0) {
 		exit_error(_('No admin users ?'),'');
 	}
-	session_set_new ($admins[0]->getID());
+	/*
+	 * Use the user with the lowest numerical user ID.
+	 * This is to prevent complaints from real humans
+	 * if the system is doing something in their stead
+	 * (for example by populate_template_project.php).
+	 * Usually, “admin” has the ID 101.
+	 */
+	$admin_ids = array();
+	foreach ($admins as $admin) {
+		$admin_ids[] = $admin->getID();
+	}
+	sort($admin_ids);
+	session_set_new($admin_ids[0]);
 }
 
 /**



More information about the evolvis-commits mailing list