Initialize and load user list
Initialize and load user list

--- /dev/null
+++ b/config/users.conf.php.example
@@ -1,1 +1,34 @@
+<?php
+/**
+ * GitPHP User config file
+ *
+ * Copy this example file to config/users.conf.php
+ *
+ * @author Christopher Han <xiphux@gmail.com>
+ * @copyright Copyright (c) 2012 Christopher Han
+ * @package GitPHP
+ * @subpackage Config
+ */
 
+/*
+ * gitphp_users
+ *
+ * An array of users
+ * Each entry in the array is an array of key value pairs:
+ * username: the user's login username
+ * password: the user's password
+ */
+
+/*
+$gitphp_users = array(
+	array(
+		'username' => 'user1',
+		'password' => 'password1'
+	),
+	array(
+		'username' => 'user2',
+		'password' => 'password2'
+	)
+);
+*/
+

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -18,6 +18,13 @@
 	protected $config;
 
 	/**
+	 * User list instance
+	 *
+	 * @var GitPHP_UserList
+	 */
+	protected $userList;
+
+	/**
 	 * Resource handler instance
 	 *
 	 * @var GitPHP_Resource
@@ -102,6 +109,8 @@
 		$this->InitializeConfig();
 
 		$this->InitializeResource();
+
+		$this->InitializeUserList();
 
 		$this->EnableLogging();
 
@@ -186,6 +195,15 @@
 	}
 
 	/**
+	 * Initialize user list
+	 */
+	public function InitializeUserList()
+	{
+		$this->userList = new GitPHP_UserList();
+		$this->userList->LoadUsers(GITPHP_CONFIGDIR . 'users.conf.php');
+	}
+
+	/**
 	 * Initialize executable
 	 *
 	 * @param boolean $validate whether the exe should be validated

--- a/include/controller/Controller_Message.class.php
+++ b/include/controller/Controller_Message.class.php
@@ -21,6 +21,8 @@
 
 		$this->InitializeResource();
 
+		$this->InitializeUserList();
+
 		$this->InitializeGitExe(false);
 
 		try {

--- a/include/controller/Controller_Snapshot.class.php
+++ b/include/controller/Controller_Snapshot.class.php
@@ -37,6 +37,8 @@
 	public function Initialize()
 	{
 		$this->InitializeConfig();
+
+		$this->InitializeUserList();
 
 		$this->InitializeGitExe();
 

comments