Commit 1c189079 authored by Leigh Stoller's avatar Leigh Stoller

Add support for toggling the skipvlans control.

parent 1358a9af
......@@ -307,6 +307,7 @@ class Experiment
function locked() { return $this->field('expt_locked'); }
function elabinelab() { return $this->field('elab_in_elab');}
function lockdown() { return $this->field('lockdown'); }
function skipvlans() { return $this->field('skipvlans'); }
function created() { return $this->field('expt_created'); }
function swapper() { return $this->field('expt_swap_uid');}
function swappable() { return $this->field('swappable');}
......@@ -439,6 +440,20 @@ class Experiment
return 0;
}
#
# Flip lockdown bit.
#
function SetSkipVlans($mode) {
$idx = $this->idx();
$mode = ($mode ? 1 : 0);
$query_result =
DBQueryFatal("update experiments set skipvlans='$mode' ".
"where idx='$idx'");
return 0;
}
function GetLogfile() {
$this->Refresh();
......@@ -707,6 +722,7 @@ class Experiment
$mnet_cores = $exprow["modelnet_cores"];
$mnet_edges = $exprow["modelnet_edges"];
$lockdown = $exprow["lockdown"];
$skipvlans = $exprow["skipvlans"];
$exptidx = $exprow["idx"];
$archive_idx = $exprow["archive_idx"];
$dpdb = $exprow["dpdb"];
......@@ -1005,6 +1021,17 @@ class Experiment
"&type=lockdown&value=$lockflip>Toggle</a>)
</td>
</tr>\n";
if (ISADMIN()) {
$thisflip = ($skipvlans ? 0 : 1);
$flipval = ($skipvlans ? "Yes" : "No");
echo "<tr>
<td>Skip Vlans:</td>
<td>$flipval (<a href=toggle.php?pid=$pid&eid=$eid".
"&type=skipvlans&value=$thisflip>Toggle</a>)
</td>
</tr>\n";
}
}
if ($batchmode) {
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -24,7 +24,8 @@ $isadmin = ISADMIN();
# List of valid toggles
$toggles = array("adminon", "webfreeze", "cvsweb", "lockdown", "stud",
"cvsrepo_public", "workbench", "hiderun", "widearearoot");
"cvsrepo_public", "workbench", "hiderun", "widearearoot",
"skipvlans");
# list of valid values for each toggle
$values = array("adminon" => array(0,1),
......@@ -32,6 +33,7 @@ $values = array("adminon" => array(0,1),
"cvsweb" => array(0,1),
"stud" => array(0,1),
"lockdown" => array(0,1),
"skipvlans" => array(0,1),
"cvsrepo_public" => array(0,1),
"workbench" => array(0,1),
"widearearoot" => array(0,1),
......@@ -43,6 +45,7 @@ $optargs = array("adminon" => array(),
"cvsweb" => array("user" => 1),
"stud" => array("user" => 1),
"lockdown" => array("pid" => 1, "eid" => 1),
"skipvlans" => array("pid" => 1, "eid" => 1),
"cvsrepo_public" => array("pid" => 1),
"workbench" => array("pid" => 1),
"widearearoot" => array("user" => 1),
......@@ -142,6 +145,17 @@ elseif ($type == "lockdown") {
$zapurl = CreateURL("showexp", $experiment);
$experiment->SetLockDown($value);
}
elseif ($type == "skipvlans") {
# must be admin
if (! $isadmin) {
USERERROR("You do not have permission to toggle $type!", 1);
}
if (! ($experiment = Experiment::LookupByPidEid($pid, $eid))) {
PAGEARGERROR("Experiment $pid/$eid is not a valid experiment!");
}
$zapurl = CreateURL("showexp", $experiment);
$experiment->SetSkipVlans($value);
}
elseif ($type == "cvsrepo_public") {
# Must validate the pid since we allow non-admins to do this.
if (! TBvalid_pid($pid)) {
......
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