push EVERY repo request back to git-http-backend cause it knows how to
authorPaul J R <me@pjr.cc>
Sat, 22 Sep 2012 20:46:41 +0000 (06:46 +1000)
committerPaul J R <me@pjr.cc>
Sat, 22 Sep 2012 20:46:41 +0000 (06:46 +1000)
play with clients via reads at the http level properly and works with
older clients, thats a really nice discovery - thanks git mailing list.

gwvpmini/gwvpmini_db.php
gwvpmini/gwvpmini_gitbackend.php

index 17bbb0a..b94b4ca 100644 (file)
@@ -667,6 +667,7 @@ function gwvpmini_GetUserNameFromEmail($email)
 \r
        return $retval;\r
 }
+
 function gwvpmini_GetOwnedRepos($username)\r
 {
        /*
@@ -693,6 +694,7 @@ function gwvpmini_GetOwnedRepos($username)
                $retval[$id]["name"] = $row["repos_name"];
                $retval[$id]["desc"] = $row["repos_description"];
                $retval[$id]["id"] = $row["repos_id"];
+               $retval[$id]["status"] = $row["repos_status"];
                error_log(print_r($row, true));
        }
        
@@ -700,6 +702,43 @@ function gwvpmini_GetOwnedRepos($username)
        return $retval;\r
 }
 
+function gwvpmini_GetContributedRepos($username)\r
+{\r
+       /*\r
+        *      CREATE TABLE "repos" (\r
+                       "repos_id" INTEGER PRIMARY KEY AUTOINCREMENT,\r
+                       "repos_name" TEXT,\r
+                       "repos_description" TEXT,\r
+                       "repos_owner" INTEGER\r
+        )';\r
+\r
+       */\r
+       $conn = gwvpmini_ConnectDB();\r
+\r
+\r
+       $uid = gwvpmini_GetUserId($username);\r
+       $sql = "select repos_id,repos_description,repos_perms,repos_owernid,repos_status from repos";\r
+       $res = $conn->query($sql);\r
+       if($username == "") return false;\r
+\r
+       $retval = false;
+       $rids = null;
+       $i = 0;\r
+       foreach($res as $row) {
+               $perms = unserialize(base64_decode($row["repos_perms"]));
+               if(isset($perms["$uid"])) if($perms["$uid"] > 1) {
+                       $rids[$i]["id"] = $row["repos_id"];
+                       $rids[$i]["desc"] = $row["repos_description"];
+                       $rids[$i]["ownerid"] = $row["repos_ownerid"];
+                       $rids[$i]["status"] = $row["repos_status"];
+                       $i++;
+               }
+       }\r
+\r
+       error_log(print_r($retval, true));\r
+       return $retval;\r
+}
+
 function gwvpmini_userLevel($id)
 {
        $conn = gwvpmini_ConnectDB();
index 10bb77c..bea736d 100644 (file)
@@ -89,9 +89,6 @@ function gwvpmini_gitBackendInterface()
                        $write = true;
                }
        }
-       if($_SERVER["REQUEST_METHOD"] == "POST") {
-               $write = true;
-       }
        
        //$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
@@ -139,13 +136,14 @@ function gwvpmini_gitBackendInterface()
        }
        
        // if its a write, we push for authentication
-       if($write) {
+       
+       //if($write) {
                gwvpmini_callGitBackend($person, $repo);
                return;
-       }
+       //}
 
        // if we made it this far, we a read and we have permissions to do so, just search the file from the repo
-       if(file_exists("$repo_base/$repo.git/$newloc")) {
+       /*if(file_exists("$repo_base/$repo.git/$newloc")) {
                error_log("would ask $repo for $repo.git/$newloc from $repo_base/$repo.git/$newloc");
                $fh = fopen("$repo_base/$repo.git/$newloc", "rb");
                
@@ -157,7 +155,7 @@ function gwvpmini_gitBackendInterface()
                error_log("would ask $repo for $repo/$newloc from $repo_base/$repo/$newloc, NE");
                gwvpmini_fourZeroFour();
                return;
-       }
+       }*/
        
 }