Commit 4df405d6 authored by Chad Barb's avatar Chad Barb

Users can, via, moduserinfo, set a preferred shell.
One of {tcsh, bash, csh, sh}.
When users are created, they are given tcsh.
All users which already exist have been given tcsh.
parent b438d5f5
......@@ -165,9 +165,8 @@ CREATE TABLE eventlist (
KEY vnode (vnode)
) TYPE=MyISAM;
--
-- Table structure for table 'experiment_stats'
-- Table structure for table 'experiment_resources'
--
CREATE TABLE experiment_resources (
......@@ -1296,6 +1295,7 @@ CREATE TABLE users (
usr_zip tinytext,
usr_country tinytext,
usr_phone tinytext,
usr_shell tinytext,
usr_pswd tinytext NOT NULL,
unix_uid smallint(5) unsigned NOT NULL auto_increment,
status enum('newuser','unapproved','unverified','active','frozen','other') NOT NULL default 'newuser',
......
......@@ -573,3 +573,9 @@ last_net_act,last_cpu_act,last_ext_act);
update experiments set expt_swap_uid=expt_head_uid
where expt_swapped is not null;
1.148: Add usr_shell to users table to specify user's preferred shell.
Retroactively make each user's preferred shell 'tcsh'.
ALTER TABLE users ADD COLUMN usr_shell TINYTEXT AFTER usr_phone;
UPDATE users SET usr_shell='tcsh';
......@@ -661,13 +661,13 @@ if (! $returning) {
DBQueryFatal("INSERT INTO users ".
"(uid,usr_created,usr_expires,usr_name,usr_email,usr_addr,".
" usr_addr2,usr_city,usr_state,usr_zip,usr_country, ".
" usr_URL,usr_phone,usr_title,usr_affil,usr_pswd,unix_uid,".
" usr_URL,usr_phone,usr_shell,usr_title,usr_affil,usr_pswd,unix_uid,".
" status,pswd_expires,usr_modified) ".
"VALUES ('$joining_uid', now(), '$usr_expires', '$usr_name', ".
"'$usr_email', ".
"'$usr_addr', '$usr_addr2', '$usr_city', '$usr_state', '$usr_zip', ".
"'$usr_country', ".
"'$usr_URL', '$usr_phone', '$usr_title', '$usr_affil', ".
"'$usr_URL', '$usr_phone', 'tcsh', '$usr_title', '$usr_affil', ".
"'$encoding', NULL, 'newuser', ".
"date_add(now(), interval 1 year), now())");
......
......@@ -22,6 +22,10 @@ LOGGEDINORDIE($uid,
CHECKLOGIN_USERSTATUS|CHECKLOGIN_PSWDEXPIRED|CHECKLOGIN_WEBONLY);
$isadmin = ISADMIN($uid);
$shelllist = array( 'tcsh', 'bash', 'csh', 'sh' );
$defaultshell = 'tcsh';
#
# Spit the form out using the array of data and error strings (if any).
#
......@@ -29,6 +33,7 @@ function SPITFORM($formfields, $errors)
{
global $TBDB_UIDLEN, $TBDB_PIDLEN, $TBDB_GIDLEN, $isadmin;
global $target_uid;
global $shelllist, $defaultshell;
#
# Standard Testbed Header. Written late cause of password
......@@ -193,6 +198,28 @@ function SPITFORM($formfields, $errors)
size=15></td></tr>
</table></center></td></tr>";
#
# Default Group
#
# $q = DBQueryWarn("select gid, pid
# Default Shell
echo "<tr><td colspan=2>Shell:</td>
<td class=left>";
echo "<select name=\"formfields[usr_shell]\">";
foreach ($shelllist as $s) {
if ((!isset($formfields[usr_shell]) &&
0 == strcmp($defaultshell, $s)) ||
0 == strcmp($formfields[usr_shell],$s)) {
$sel = "selected='1'";
} else {
$sel = "";
}
echo "<option value='$s' $sel>$s</option>";
}
echo "</select></td></tr>";
#
# Phone
#
......@@ -329,6 +356,7 @@ $defaults[usr_name] = stripslashes($row[usr_name]);
$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]);
#
# On first load, display a form consisting of current user values, and exit.
......@@ -359,6 +387,10 @@ if (!isset($formfields[usr_affil]) ||
strcmp($formfields[usr_affil], "") == 0) {
$errors["Affiliation"] = "Missing Field";
}
if (!isset($formfields[usr_shell]) ||
!in_array($formfields[usr_shell], $shelllist)) {
$errors["Shell"] = "Invalid Shell";
}
if (!isset($formfields[usr_email]) ||
strcmp($formfields[usr_email], "") == 0) {
$errors["Email Address"] = "Missing Field";
......@@ -441,6 +473,7 @@ $usr_state = addslashes($formfields[usr_state]);
$usr_zip = addslashes($formfields[usr_zip]);
$usr_country = addslashes($formfields[usr_country]);
$usr_phone = $formfields[usr_phone];
$usr_shell = $formfields[usr_shell];
$password1 = $formfields[password1];
$password2 = $formfields[password2];
......@@ -545,6 +578,7 @@ if (strcmp($defaults[usr_name], $formfields[usr_name]) ||
strcmp($defaults[usr_phone], $formfields[usr_phone]) ||
strcmp($defaults[usr_title], $formfields[usr_title]) ||
strcmp($defaults[usr_affil], $formfields[usr_affil]) ||
strcmp($defaults[usr_shell], $formfields[usr_shell]) ||
# Check this too, since we want to call out if the email addr changed.
strcmp($defaults[usr_email], $formfields[usr_email])) {
......@@ -560,6 +594,7 @@ if (strcmp($defaults[usr_name], $formfields[usr_name]) ||
"usr_phone=\"$usr_phone\", ".
"usr_title=\"$usr_title\", ".
"usr_affil=\"$usr_affil\", ".
"usr_shell=\"$usr_shell\", ".
"usr_modified=now() ".
"WHERE uid=\"$target_uid\"");
......@@ -585,7 +620,8 @@ if (strcmp($defaults[usr_name], $formfields[usr_name]) ||
"ZIP/Postal Code: $usr_zip\n".
"Country: $usr_country\n".
"Phone: $usr_phone\n".
"Title: $usr_title\n",
"Title: $usr_title\n".
"Shell: $usr_shell\n",
"From: $TBMAIL_OPS\n".
$BCC .
"Errors-To: $TBMAIL_WWW");
......
......@@ -912,14 +912,14 @@ if (! $returning) {
DBQueryFatal("INSERT INTO users ".
"(uid,usr_created,usr_expires,usr_name,usr_email,usr_addr,".
" usr_addr2,usr_city,usr_state,usr_zip,usr_country, ".
" usr_URL,usr_title,usr_affil,usr_phone,usr_pswd,unix_uid,".
" usr_URL,usr_title,usr_affil,usr_phone,usr_shell,usr_pswd,unix_uid,".
" status,pswd_expires,usr_modified) ".
"VALUES ('$proj_head_uid', now(), '$proj_expires', '$usr_name', ".
"'$usr_email', ".
"'$usr_addr', '$usr_addr2', '$usr_city', '$usr_state', '$usr_zip', ".
"'$usr_country', ".
"'$usr_URL', '$usr_title', '$usr_affil', ".
"'$usr_phone', '$encoding', NULL, 'newuser', ".
"'$usr_phone', 'tcsh', '$encoding', NULL, 'newuser', ".
"date_add(now(), interval 1 year), now())");
DBQueryFatal("INSERT INTO user_stats (uid) VALUES ('$proj_head_uid')");
......
......@@ -367,6 +367,7 @@ function SHOWUSER($uid) {
$usr_country = stripslashes($row[usr_country]);
$usr_name = stripslashes($row[usr_name]);
$usr_phone = $row[usr_phone];
$usr_shell = stripslashes($row[usr_shell]);
$usr_title = stripslashes($row[usr_title]);
$usr_affil = stripslashes($row[usr_affil]);
$status = $row[status];
......@@ -465,6 +466,11 @@ function SHOWUSER($uid) {
<td>Phone #:</td>
<td>$usr_phone</td>
</tr>\n";
echo "<tr>
<td>Shell:</td>
<td>$usr_shell</td>
</tr>\n";
echo "<tr>
<td>Title/Position:</td>
......
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