From d0216e56e8d414ea31744887a95aab4372bfc156 Mon Sep 17 00:00:00 2001 From: paulr Date: Mon, 7 Nov 2011 21:14:15 +1100 Subject: [PATCH] moved permissions to radio boxes fixed db publishication --- gwvplib/gwvpdatabase.php | 1 + gwvplib/gwvprepoadmin.php | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/gwvplib/gwvpdatabase.php b/gwvplib/gwvpdatabase.php index b45e360..792c1f7 100644 --- a/gwvplib/gwvpdatabase.php +++ b/gwvplib/gwvpdatabase.php @@ -75,6 +75,7 @@ function gwvp_dbCreateSQLiteStructure($dbloc) $DB_CONNECTION->query($usersql); $DB_CONNECTION->query($groupsql); $DB_CONNECTION->query($reposql); + $DB_CONNECTION->query($repoperms); $DB_CONNECTION->query($configsql); $DB_CONNECTION->query($groupmemsql); } diff --git a/gwvplib/gwvprepoadmin.php b/gwvplib/gwvprepoadmin.php index baa7cf1..09f7481 100644 --- a/gwvplib/gwvprepoadmin.php +++ b/gwvplib/gwvprepoadmin.php @@ -55,6 +55,24 @@ function gwvp_DoCreateRepoPage() $reponame = $_REQUEST["reponame"]; $repodesc = $_REQUEST["repodesc"]; + $defperms = 0; + + if(isset($_REQUEST["defperms"])) { + switch($_REQUEST["defperms"]) { + case "permsall": + $defperms = 0; + break; + case "permsmeonly": + $defperms = 1; + break; + case "permsinvisible": + $defperms = 2; + break; + default: + $defperms = 2; + } + } + // TODO: this code is bollocks, need to redo if(gwvp_repoExists($reponame)) { gwvp_SendMessage("error", "a repository with the name \"$reponame\" already exists"); @@ -63,9 +81,9 @@ function gwvp_DoCreateRepoPage() error_log("bundle file tmpname is ".$_FILES["bundlefile"]["tmp_name"]); // function gwvp_createGitRepo($name, $ownerid, $desc, $defaultperms=0, $bundle=null) // TODO: deal with default perms - gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc, $_FILES["bundlefile"]["tmp_name"]); + gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc, $_FILES["bundlefile"]["tmp_name"], $defperms); gwvp_SendMessage("info", "Repo, $reponame, created"); - } else if(gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc)) { + } else if(gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc, null, $defperms)) { gwvp_SendMessage("info", "Repo, $reponame, created"); } header("Location: $BASE_URL/admin/repos"); @@ -94,9 +112,9 @@ function gwvp_CreateRepoPageBody() echo "Default Permisison Set"; echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; echo "
Anyone Can Read, Only you can write
Anyone can see the repository exists, but only you can read or write to it
Repository only visible to you
Anyone Can Read, Only you can write
Anyone can see the repository exists, but only you can read or write to it
Repository only visible to you
"; -- 1.7.0.4