From: Paul J R Date: Fri, 21 Sep 2012 00:34:13 +0000 (+1000) Subject: permissions check/management code X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=a3b66e70489344971de3334b7865837009c82c2c;p=gwvp-mini.git permissions check/management code --- diff --git a/gwvpmini/gwvpmini_db.php b/gwvpmini/gwvpmini_db.php index 4e939af..63b8f84 100644 --- a/gwvpmini/gwvpmini_db.php +++ b/gwvpmini/gwvpmini_db.php @@ -142,6 +142,30 @@ function gwvpmini_ChangeRepoPerm($rid, $uid, $acc) } +function gwvpmini_GetRepoPerms($rid) +{ + $conn = gwvpmini_ConnectDB(); + + $sql = "select repos_perms from repos where repos_id='$rid'"; + + $res = $conn->query($sql); + + $cperms_t = false; + if($res !== false) foreach($res as $row) { + $cperms_t = $row[0]; + } + + if($cperms_t === false) return 0; + + error_log("PERMSCHECK $rid, $uid:".print_r($dets, true)); + + if($dets === false) return 0; + + if($dets["ownerid"] == $uid) return 2; + + $permsarray = unserialize(base64_decode($cperms_t)); +} + //returns 0 for none, 1 for read, 2 for writes function gwvpmini_GetRepoPerm($rid, $uid) { @@ -153,8 +177,6 @@ function gwvpmini_GetRepoPerm($rid, $uid) $res = $conn->query($sql); - error_log("PERMCHECK: FUCK U! $sql"); - $cperms_t = false; if($res !== false) foreach($res as $row) { $cperms_t = $row[0]; diff --git a/gwvpmini/gwvpmini_view.php b/gwvpmini/gwvpmini_view.php index 47effbe..5862068 100644 --- a/gwvpmini/gwvpmini_view.php +++ b/gwvpmini/gwvpmini_view.php @@ -91,8 +91,11 @@ function gwvpmini_RepoViewPageBody() error_log("BPERMS: $bperms"); + if($bperms == "x") $cspan = 3; + else $cspan = 2; + + echo "
Permissions
"; echo "
"; - echo "Base Permissions "; echo ""; echo ""; echo "
"; + if($bperms == "x") { + echo "
Readers
"; + echo "
"; + echo " "; + echo "

"; + } + + echo "
Contributors"; + echo "
"; + echo " "; + echo "

"; + echo "
"; } //echo "command: git log --git-dir=$repo_base/$repo_view_call.git --pretty=format:\"%H\" -10"; $rs = popen("git --git-dir=$repo_base/$repo_view_call.git log --pretty=format:\"%H\" -10", "r");