Commit ff21d454 authored by Leigh Stoller's avatar Leigh Stoller

Add a toggle for widearearoot bit in the user record.

parent 5dd89058
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -24,7 +24,7 @@ $isadmin = ISADMIN();
# List of valid toggles
$toggles = array("adminon", "webfreeze", "cvsweb", "lockdown", "stud",
"cvsrepo_public", "workbench", "hiderun");
"cvsrepo_public", "workbench", "hiderun", "widearearoot");
# list of valid values for each toggle
$values = array("adminon" => array(0,1),
......@@ -34,6 +34,7 @@ $values = array("adminon" => array(0,1),
"lockdown" => array(0,1),
"cvsrepo_public" => array(0,1),
"workbench" => array(0,1),
"widearearoot" => array(0,1),
"hiderun" => array(0,1));
# list of valid extra variables for the each toggle, and mandatory flag.
......@@ -44,6 +45,7 @@ $optargs = array("adminon" => array(),
"lockdown" => array("pid" => 1, "eid" => 1),
"cvsrepo_public" => array("pid" => 1),
"workbench" => array("pid" => 1),
"widearearoot" => array("user" => 1),
"hiderun" => array("instance" => 1, "runidx" => 1));
# Mandatory page arguments.
......@@ -118,6 +120,17 @@ elseif ($type == "stud") {
$zapurl = CreateURL("showuser", $target_user);
$target_user->SetStudly($value);
}
elseif ($type == "widearearoot") {
# must be admin
if (! $isadmin) {
USERERROR("You do not have permission to toggle $type!", 1);
}
if (! ($target_user = User::Lookup($user))) {
PAGEARGERROR("Target user '$user' is not a valid user!");
}
$zapurl = CreateURL("showuser", $target_user);
$target_user->SetWideAreaRoot($value);
}
elseif ($type == "lockdown") {
# must be admin
if (! $isadmin) {
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006, 2007 University of Utah and the Flux Group.
# Copyright (c) 2006, 2007, 2008 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -655,6 +655,7 @@ class User
$failstamp = $user->weblogin_failstamp();
$wikiname = $user->wikiname();
$cvsweb = $user->cvsweb();
$widearearoot= $user->widearearoot();
$wikionly = $user->wikionly();
$stud = $user->stud();
$uuid = $user->uuid();
......@@ -825,6 +826,15 @@ class User
<td>CVSWeb Access:</td>
<td>$cvsweb (<a href='$toggle_url'>Toggle</a>)
</tr>\n";
$widearearootflip = ($widearearoot ? 0 : 1);
$toggle_url = CreateURL("toggle", $user,
"type", "widearearoot",
"value", $widearearootflip);
echo "<tr>
<td>Widearearoot:</td>
<td>$widearearoot (<a href='$toggle_url'>Toggle</a>)
</tr>\n";
$freezeflip = ($frozen ? 0 : 1);
$toggle_url = CreateURL("toggle", $user,
......@@ -1019,6 +1029,17 @@ class User
$this->user["stud"] = $onoff;
return 0;
}
function SetWideAreaRoot($onoff) {
$idx = $this->uid_idx();
$onoff = ($onoff ? 1 : 0);
DBQueryFatal("update users set ".
" widearearoot='$onoff' ".
"where uid_idx='$idx'");
$this->user["stud"] = $onoff;
return 0;
}
function UpdateWebLoginFail() {
$idx = $this->uid_idx();
......
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