Commit 73bf1395 authored by Leigh Stoller's avatar Leigh Stoller

Do not send email when administrators (adminmode on *or* off) change

the swap/idle settings on their own experiments. This accounts for
90% of the idle settings email, 90% of which is Mike playing with red
and green dots.
parent 54efd0a8
......@@ -51,7 +51,7 @@ if (! in_array($value, $values[$type])) {
#
if ($type=="adminoff") {
# must be admin
# Don't check if they are admin mode (ISADMIN), check if they
# Do not check if they are admin mode (ISADMIN), check if they
# have the power to change to admin mode!
if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_ISADMIN) ) {
USERERROR("You do not have permission to toggle $type!", 1);
......@@ -60,8 +60,8 @@ if ($type=="adminoff") {
if (!isset($target_uid)) { $target_uid = $uid; }
DBQueryFatal("update users set adminoff=$value where uid='$target_uid'");
} elseif ($type=="swappable" || $type=="idleswap" || $type=="autoswap") {
}
elseif ($type=="swappable" || $type=="idleswap" || $type=="autoswap") {
# must be admin OR must have permission to modify the expt...
if (! ISADMIN() && !TBExptAccessCheck($uid, $pid, $eid, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to toggle $type!", 1);
......@@ -81,38 +81,46 @@ if ($type=="adminoff") {
$q = DBQueryFatal("select * from experiments ".
"where pid='$pid' and eid='$eid'");
$r = mysql_fetch_array($q);
$s = ($r[swappable] ? "Yes" : "No");
$sr= $r[noswap_reason];
$i = ($r[idleswap] ? "Yes" : "No");
$it= $r[idleswap_timeout] / 60.0;
$ir= $r[noidleswap_reason];
$a = ($r[autoswap] ? "Yes" : "No");
$at= $r[autoswap_timeout] / 60.0;
$cuid = $r[expt_head_uid];
$suid= $r[expt_swap_uid];
TBUserInfo($uid, $user_name, $user_email);
TBUserInfo($cuid, $cname, $cemail);
TBUserInfo($suid, $sname, $semail);
TBMAIL($TBMAIL_OPS,"$pid/$eid swap settings changed",
"\nThe swap settings for $pid/$eid have changed.\n".
"\nThe $type bit has been cleared.\n".
"\nThe new settings are:\n".
"Swappable:\t$s\t('$sr')\n".
"Idleswap:\t$i\t(after $it hrs)\t('$ir')\n".
"Autoswap:\t$a\t(after $at hrs)\n".
"\nCreator:\t$cuid ($cname <$cemail>)\n".
"Swapper:\t$suid ($sname <$semail>)\n".
"\nIf it is necessary to change these settings, ".
"please reply to this message \nto notify the user, ".
"then change the settings here:\n\n".
"$TBBASE/showexp.php3?pid=$pid&eid=$eid\n\n".
"Thanks,\nTestbed WWW\n",
"From: $user_name <$user_email>\n".
"Errors-To: $TBMAIL_WWW");
$suid = $r[expt_swap_uid];
#
# Do not send this email if the user is an administrator
# (adminmode does not matter), and is changing an experiment
# he created or swapped in. Pointless email.
#
if (! (ISADMINISTRATOR() &&
(!strcmp($uid, $cuid) || !strcmp($uid, $suid)))) {
$s = ($r[swappable] ? "Yes" : "No");
$sr= $r[noswap_reason];
$i = ($r[idleswap] ? "Yes" : "No");
$it= $r[idleswap_timeout] / 60.0;
$ir= $r[noidleswap_reason];
$a = ($r[autoswap] ? "Yes" : "No");
$at= $r[autoswap_timeout] / 60.0;
TBUserInfo($uid, $user_name, $user_email);
TBUserInfo($cuid, $cname, $cemail);
TBUserInfo($suid, $sname, $semail);
TBMAIL($TBMAIL_OPS,"$pid/$eid swap settings changed",
"\nThe swap settings for $pid/$eid have changed.\n".
"\nThe $type bit has been cleared.\n".
"\nThe new settings are:\n".
"Swappable:\t$s\t('$sr')\n".
"Idleswap:\t$i\t(after $it hrs)\t('$ir')\n".
"Autoswap:\t$a\t(after $at hrs)\n".
"\nCreator:\t$cuid ($cname <$cemail>)\n".
"Swapper:\t$suid ($sname <$semail>)\n".
"\nIf it is necessary to change these settings, ".
"please reply to this message \nto notify the user, ".
"then change the settings here:\n\n".
"$TBBASE/showexp.php3?pid=$pid&eid=$eid\n\n".
"Thanks,\nTestbed WWW\n",
"From: $user_name <$user_email>\n".
"Errors-To: $TBMAIL_WWW");
}
}
} elseif ($type=="idle_ignore") {
}
elseif ($type=="idle_ignore") {
# must be admin
if (! ISADMIN() ) {
USERERROR("You do not have permission to toggle $type!", 1);
......
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