diff admin/application/libraries/hg_confparser.php @ 4:1648e02be7e0

Global lockout permission config
author joshjcarrier
date Thu, 29 Apr 2010 15:29:40 -0700
parents 53341b414217
children 6e512b1d054f
line wrap: on
line diff
--- a/admin/application/libraries/hg_confparser.php	Wed Apr 28 12:55:39 2010 -0700
+++ b/admin/application/libraries/hg_confparser.php	Thu Apr 29 15:29:40 2010 -0700
@@ -39,6 +39,10 @@
 	}
 	
 	/**
+	 * Public accessors - hgweb.config
+	 */
+	
+	/**
 	 * Returns a list of available repositories.
 	 * Will show up if: detected in repo directory
 	 * Will have status "enabled" if: detected in hgweb.config
@@ -80,6 +84,48 @@
 		$this->__hgwebconf_compat_persist($collections);
 	}
 	
+	/**
+	 * Public accessors - hgrc
+	 */
+	 
+	 /* TODO */
+	 
+	 /**
+	  * Public accessors - permissions
+	  */
+	  
+	function can_create($repository_name)
+
+	{
+		return $this->_hgwebconf_allow_repo_create;
+	}
+	/**
+	 * Public helpers - filesystem
+	 */
+	 
+	function create_repository($repository_name)
+	{
+		if(!$this->can_create($repository_name))
+		{
+			return false;
+		}
+		
+		$cd = $this->_repositories_rel_dir;
+		mkdir($cd . $repository_name);
+		mkdir($cd . $repository_name . '/.hg/store/data/', 755, TRUE);
+		
+		// create hgrc
+		return $this->__hgrc_persist($repository_name);
+	}
+	
+	function delete_repository($repository_name)
+	{
+		
+	}
+	 
+	  /**
+	   * Private helpers - hgweb.config
+	   */
 	
 	/**
 	 * Performs a real directory scan where the projects are suppose to reside.
@@ -217,22 +263,13 @@
 		
 		// cleanup 
 		unlink($hgwebconf_lock_path);
+		
+		return true;
 	}
 	
-	function create_repository($repository_name)
-	{
-		$cd = $this->_repositories_rel_dir;
-		mkdir($cd . $repository_name);
-		mkdir($cd . $repository_name . '/.hg/store/data/', 755, TRUE);
-		
-		// create hgrc
-		$this->__hgrc_persist($repository_name);
-	}
+	
 	
-	function delete_repository($repository_name)
-	{
-		
-	}
+	
 	
 	function getProjectParams()
 	{
@@ -250,5 +287,7 @@
 		
 		// create file
 		touch($cd . 'hgrc');
+		
+		return true;
 	}
 }