moved the old git poc code off and away from the main directory
[gwvp.git] / gwvplib / gwvpgitcontrol.php
index 842d040..7c34d9b 100644 (file)
@@ -6,6 +6,9 @@ $CALL_ME_FUNCTIONS["gitcontrol"] = "gwvp_gitControlCallMe";
 //$MENU_ITEMS["20repos"]["link"] = "$BASE_URL/admin/repos";
 $HOME_PAGE_PROVIDERS["gitlog"] = "gwvp_GitLogProvider";
 
+// TODO: we could actually change backend interface such that is
+// will respond to any url's that contain "repo.git" rather then
+// having to be $BASE_URL/git/repo.git
 function gwvp_gitControlCallMe()
 {
        if(isset($_REQUEST["q"])) {
@@ -42,6 +45,20 @@ function gwvp_gitBackendInterface()
        
        // TODO: we need to stop passing the repo name around as "repo.git", it needs to be just "repo"
        
+       
+       /* bizare git problem that ignores 403's or continues on with a push despite them 
+       error_log("FLAP for ".$_SERVER["REQUEST_URI"]);
+       if(isset($_REQUEST)) {
+               $dump = print_r($_REQUEST, true);
+               error_log("FLAP, $dump");
+       }
+       if(isset($_SERVER["PHP_AUTH_USER"])) {
+               error_log("FLAP: donut hole");
+       }*/
+       
+       
+
+       
        $repo = "";
        $repoid = false;
        $newloc = "/";
@@ -71,12 +88,18 @@ function gwvp_gitBackendInterface()
        $write = false;
        if(isset($_REQUEST["service"])) {
                if($_REQUEST["service"] == "git-receive-pack") {
+                       error_log("got write as receivepack in post");
                        $write = true;
                }
        }
        if($_SERVER["REQUEST_METHOD"] == "POST") {
                $write = true;
        }
+       // THIS MAY CAUSE ISSUES LATER ON but we do it cause the git client ignores our 403 when it uses git-receive-pack after an auth
+       // no, this isnt a solution cause auth'd read attempts will come up as writes...
+       //if(isset($_SERVER["PHP_AUTH_USER"])) {
+               //$write = true;
+       //}
        
        // if its a write, we push for authentication
        if($write) {
@@ -465,6 +488,7 @@ function gwvp_createGitRepo($name, $ownerid, $desc, $bundle=null, $defaultperms=
 // 1 - visible
 // 2 - read
 // 3 - write
+// 4 - owner/administrator
 function gwvp_resolvRepoPerms($userid, $repoid)
 {
        $ownerid = gwvp_getRepoOwner($repoid);
@@ -472,9 +496,9 @@ function gwvp_resolvRepoPerms($userid, $repoid)
        
        error_log("USerid is $userid, ownerid $ownerid");
        
-       if($isadmin) return 3;
+       if($isadmin) return 4;
        
-       if($userid == $ownerid) return 3;
+       if($userid == $ownerid) return 4;
        
        // now we load the perms table and pray
        $repoperms = gwvp_getRepoPermissions($repoid);