Commit e656f774 authored by Robert Ricci's avatar Robert Ricci

Add the ability to edit the plab_user bit - for admins only, right

now.
parent d74a8933
......@@ -254,6 +254,25 @@ function SPITFORM($formfields, $errors)
size=8></td>
</tr>\n";
#
# Planetlab bit
#
if ($isadmin) {
if ($formfields['plab_user']) {
$checked = "checked";
} else {
$checked = "";
}
echo "<tr>
<td colspan=2>PlanetLab User:</td>
<td class=left>
<input type='checkbox' name=\"formfields[plab_user]\" value='1'
$checked>
</td>
</tr>\n";
}
#
# Notes
#
......@@ -371,6 +390,7 @@ $defaults[usr_title] = $row[usr_title];
$defaults[usr_affil] = $row[usr_affil];
$defaults[usr_shell] = $row[usr_shell];
$defaults[notes] = $row[notes];
$defaults[plab_user] = $row[plab_user];
#
# On first load, display a form consisting of current user values, and exit.
......@@ -584,6 +604,20 @@ if ($isadmin &&
"WHERE uid='$target_uid'");
}
#
# Only admins can change the plab_user bit.
#
if ($isadmin && ($defaults[plab_user] != $formfields[plab_user])) {
if ($formfields[plab_user]) {
$new_bit = 1;
} else {
$new_bit = 0;
}
DBQueryFatal("UPDATE users SET plab_user=$new_bit ".
"WHERE uid='$target_uid'");
}
#
# Now change the rest of the information, but only if the user actually
# changed the info. We use the original info in the defaults array and
......
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