Commit 61e89301 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add admin-only notes field to the users table. You can set this field

as an admin if you go to a users moduserinfo page. I'll be using this
to flag accounts frozen due to email problems.
parent b84ece7c
......@@ -1361,6 +1361,7 @@ CREATE TABLE users (
verify_key varchar(32) default NULL,
widearearoot tinyint(4) default '0',
wideareajailroot tinyint(4) default '0',
notes text,
PRIMARY KEY (uid),
KEY unix_uid (unix_uid),
KEY status (status)
......
......@@ -913,3 +913,9 @@ last_net_act,last_cpu_act,last_ext_act);
where role='ctrl' or role='ctrl' or role='fake';
update veth_interfaces set mask='255.255.255.0';
update tunnels set mask='255.255.255.0';
1.177: Add notes field to the users table for storing admin only
notes.
alter table users add notes text after wideareajailroot;
......@@ -28,7 +28,7 @@ $isadmin = ISADMIN($uid);
$shelllist = array( 'tcsh' );
# $shelllist = array( 'tcsh', 'bash', 'csh', 'sh' );
# used if db is NULL (shouldn't happen.)
# used if db is NULL (should not happen.)
$defaultshell = 'tcsh';
#
......@@ -206,9 +206,7 @@ function SPITFORM($formfields, $errors)
#
# Default Group
#
# $q = DBQueryWarn("select gid, pid
# Default Shell
echo "<tr><td colspan=2>Shell:</td>
<td class=left>";
......@@ -258,6 +256,21 @@ function SPITFORM($formfields, $errors)
size=8></td>
</tr>\n";
#
# Notes
#
if ($isadmin) {
echo "<tr>
<td colspan=2>Admin Notes:</td>
<td class=left>
<textarea name=\"formfields[notes]\"
rows=2 cols=40>" .
ereg_replace("\r", "", $formfields[notes]) .
"</textarea>
</td>
</tr>\n";
}
echo "<tr>
<td colspan=3 align=center>
<b><input type=submit name=submit value=Submit></b>
......@@ -362,6 +375,7 @@ $defaults[usr_phone] = $row[usr_phone];
$defaults[usr_title] = stripslashes($row[usr_title]);
$defaults[usr_affil] = stripslashes($row[usr_affil]);
$defaults[usr_shell] = stripslashes($row[usr_shell]);
$defaults[notes] = stripslashes($row[notes]);
#
# On first load, display a form consisting of current user values, and exit.
......@@ -567,6 +581,18 @@ if ((isset($password1) && strcmp($password1, "")) &&
}
}
#
# Only admins can change the notes field. We do not bother to generate
# any email or external updates for this.
#
if ($isadmin &&
strcmp($defaults[notes], $formfields[notes])) {
$notes = addslashes($formfields[notes]);
DBQueryFatal("UPDATE users SET notes='$notes' ".
"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
......
......@@ -380,6 +380,7 @@ function SHOWUSER($uid) {
$status = $row[status];
$admin = $row[admin];
$adminoff = $row[adminoff];
$notes = stripslashes($row[notes]);
if (!strcmp($usr_addr2, ""))
$usr_addr2 = "&nbsp";
......@@ -391,6 +392,8 @@ function SHOWUSER($uid) {
$usr_zip = "&nbsp";
if (!strcmp($usr_country, ""))
$usr_country = "&nbsp";
if (!strcmp($notes, ""))
$notes = "&nbsp";
#
# Last Login info.
......@@ -519,6 +522,13 @@ function SHOWUSER($uid) {
<td>Last Node Login:</td>
<td>$lastnodelogin</td>
</tr>\n";
if (ISADMIN()) {
echo "<tr>
<td>Notes:</td>
<td>$notes</td>
</tr>\n";
}
echo "</table>\n";
......
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