Commit cf8defbe authored by Leigh Stoller's avatar Leigh Stoller

Add a toggle for CVS web to the user profile and toggle page.

parent b73f0d49
......@@ -411,6 +411,7 @@ function SHOWUSER($uid) {
$failcount = $row['weblogin_failcount'];
$failstamp = $row['weblogin_failstamp'];
$wikiname = $row['wikiname'];
$cvsweb = $row['cvsweb'];
if (!strcmp($usr_addr2, ""))
$usr_addr2 = "&nbsp";
......@@ -564,6 +565,14 @@ function SHOWUSER($uid) {
</tr>\n";
if (ISADMIN()) {
$cvswebflip = ($cvsweb ? 0 : 1);
echo "<tr>
<td>CVSWeb Access:</td>
<td>$cvsweb (<a href=toggle.php?target_uid=$uid".
"&type=cvsweb&value=$cvswebflip>Toggle</a>)
</tr>\n";
$freezeflip = ($frozen ? 0 : 1);
echo "<tr>
......
......@@ -23,16 +23,18 @@ LOGGEDINORDIE($uid, CHECKLOGIN_USERSTATUS|CHECKLOGIN_WEBONLY);
$isadmin = ISADMIN($uid);
# List of valid toggles
$toggles = array("adminoff", "webfreeze", "lockdown");
$toggles = array("adminoff", "webfreeze", "cvsweb", "lockdown");
# list of valid values for each toggle
$values = array("adminoff" => array(0,1),
"webfreeze" => array(0,1),
"cvsweb" => array(0,1),
"lockdown" => array(0,1));
# list of valid extra variables for the each toggle, and mandatory flag.
$optargs = array("adminoff" => array("target_uid" => 0),
"webfreeze" => array("target_uid" => 1),
"cvsweb" => array("target_uid" => 1),
"lockdown" => array("pid" => 1, "eid" => 1));
# Mandatory page arguments.
......@@ -95,6 +97,17 @@ elseif ($type == "webfreeze") {
DBQueryFatal("update users set weblogin_frozen='$value' ".
"where uid='$target_uid'");
}
elseif ($type == "cvsweb") {
# must be admin
if (! $isadmin) {
USERERROR("You do not have permission to toggle $type!", 1);
}
if (!TBCurrentUser($target_uid)) {
PAGEARGERROR("Target user '$target_uid' is not a valid user!");
}
DBQueryFatal("update users set cvsweb='$value' ".
"where uid='$target_uid'");
}
elseif ($type == "lockdown") {
# must be admin
if (! $isadmin) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment