Commit 5ac5c4ad authored by Leigh B Stoller's avatar Leigh B Stoller

Send project approval email from cloudlab-ops or aptlab-ops, for

cloudlab/aptlab generated projects.
parent a2c2d060
<?php <?php
# #
# Copyright (c) 2000-2012 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -124,6 +124,15 @@ if (! $this_project->IsMember($leader, $ignore)) { ...@@ -124,6 +124,15 @@ if (! $this_project->IsMember($leader, $ignore)) {
USERERROR("User $headuid is not the leader of project $pid.", 1); USERERROR("User $headuid is not the leader of project $pid.", 1);
} }
# For email below
$APPROVAL_MAIL = $TBMAIL_APPROVAL;
if ($this_project->isAPT()) {
$APPROVAL_MAIL = "aptlab-approval@aptlab.net";
}
elseif ($this_project->isCloud()) {
$APPROVAL_MAIL = "cloudlab-approval@cloudlab.us";
}
# #
# Well, looks like everything is okay. Change the project approval # Well, looks like everything is okay. Change the project approval
# value appropriately. # value appropriately.
...@@ -164,7 +173,7 @@ if ($approval == "postpone") { ...@@ -164,7 +173,7 @@ if ($approval == "postpone") {
} }
elseif (strcmp($approval, "moreinfo") == 0) { elseif (strcmp($approval, "moreinfo") == 0) {
SendProjAdminMail SendProjAdminMail
($pid, "ADMIN", "$headname '$headuid' <$headuid_email>", ($this_project, "ADMIN", "$headname '$headuid' <$headuid_email>",
"Project '$pid' Approval Postponed", "Project '$pid' Approval Postponed",
"\n". "\n".
"This message is to notify you that your project application\n". "This message is to notify you that your project application\n".
...@@ -173,8 +182,7 @@ elseif (strcmp($approval, "moreinfo") == 0) { ...@@ -173,8 +182,7 @@ elseif (strcmp($approval, "moreinfo") == 0) {
"to provide that information or report your actions.\n". "to provide that information or report your actions.\n".
"\n$message". "\n$message".
"\n\n". "\n\n".
"Thanks,\n". "Thanks!\n");
"Testbed Operations\n");
echo "<p><h3> echo "<p><h3>
Project approval for project $pid (User: $headuid) was Project approval for project $pid (User: $headuid) was
...@@ -235,9 +243,8 @@ elseif ((strcmp($approval, "deny") == 0) || ...@@ -235,9 +243,8 @@ elseif ((strcmp($approval, "deny") == 0) ||
"This message is to notify you that your account has \n". "This message is to notify you that your account has \n".
"been terminated because your project $pid was denied.\n". "been terminated because your project $pid was denied.\n".
"\n\n". "\n\n".
"Thanks,\n". "Thanks\n",
"Testbed Operations\n", "From: $APPROVAL_MAIL\n".
"From: $TBMAIL_APPROVAL\n".
"Bcc: $TBMAIL_APPROVAL\n". "Bcc: $TBMAIL_APPROVAL\n".
"Errors-To: $TBMAIL_WWW"); "Errors-To: $TBMAIL_WWW");
} }
...@@ -265,9 +272,8 @@ elseif ((strcmp($approval, "deny") == 0) || ...@@ -265,9 +272,8 @@ elseif ((strcmp($approval, "deny") == 0) ||
"for $pid has been denied.\n". "for $pid has been denied.\n".
"\n$message". "\n$message".
"\n\n". "\n\n".
"Thanks,\n". "Thanks\n",
"Testbed Operations\n", "From: $APPROVAL_MAIL\n".
"From: $TBMAIL_APPROVAL\n".
"Bcc: $TBMAIL_APPROVAL\n". "Bcc: $TBMAIL_APPROVAL\n".
"Errors-To: $TBMAIL_WWW"); "Errors-To: $TBMAIL_WWW");
} }
......
...@@ -341,7 +341,7 @@ if (!$this_user) { ...@@ -341,7 +341,7 @@ if (!$this_user) {
$args["affiliation"] = $formfields["affiliation"]; $args["affiliation"] = $formfields["affiliation"];
$args["password"] = $formfields["password1"]; $args["password"] = $formfields["password1"];
# Flag to the backend. # Flag to the backend.
$args["viaAPT"] = 1; $args["genesis"] = ($ISAPT ? "aptlab" : "cloudlab");
# #
# Backend verifies pubkey and returns error. We first look for a # Backend verifies pubkey and returns error. We first look for a
...@@ -427,14 +427,14 @@ $args["linkedtous"] = 1; ...@@ -427,14 +427,14 @@ $args["linkedtous"] = 1;
$args["plab"] = 0; $args["plab"] = 0;
$args["ron"] = 0; $args["ron"] = 0;
$args["funders"] = "None"; $args["funders"] = "None";
$args["whynotpublic"] = "APT"; $args["whynotpublic"] = ($ISAPT ? "aptlab" : "cloudlab");
# Flag to the backend. # Flag to the backend.
$args["viaAPT"] = 1; $args["genesis"] = ($ISAPT ? "aptlab" : "cloudlab");
if (! ($project = Project::NewNewProject($args, $error))) { if (! ($project = Project::NewNewProject($args, $error))) {
$errors["error"] = $error; $errors["error"] = $error;
if ($suexec_retval < 0) { if ($suexec_retval < 0) {
TBERROR("Error Creating APT Project\n${error}\n\n" . TBERROR("Error Creating APT/CloudLab Project\n${error}\n\n" .
print_r($args, TRUE), 0); print_r($args, TRUE), 0);
} }
SPITFORM($formfields, 0, $errors); SPITFORM($formfields, 0, $errors);
......
...@@ -244,11 +244,17 @@ function TBMAIL($to, $subject, $message, $headers = 0) ...@@ -244,11 +244,17 @@ function TBMAIL($to, $subject, $message, $headers = 0)
# Identical to perl function of the same name # Identical to perl function of the same name
# #
# #
function SendProjAdminMail($proj, $from, $to, $subject, $message, $headers = "") function SendProjAdminMail($project, $from, $to,
$subject, $message, $headers = "")
{ {
global $MAILMANSUPPORT, $TBMAIL_APPROVAL, $TBMAIL_AUDIT, $OURDOMAIN, $TBMAIL_WWW; global $MAILMANSUPPORT, $TBMAIL_APPROVAL, $TBMAIL_AUDIT;
$projadminmail = 0 && $MAILMANSUPPORT ? global $OURDOMAIN, $TBMAIL_WWW;
"$proj-admin@$OURDOMAIN" : $TBMAIL_APPROVAL; $pid = $project->pid();
$projadminmail =
($project->isAPT() ? "aptlab-approval@aptlab.net" :
$project->isCloud() ? "cloudlab-approval@cloudlab.us" :
$TBMAIL_APPROVAL);
if ($headers) { if ($headers) {
$headers .= "\n"; $headers .= "\n";
} }
......
<?php <?php
# #
# Copyright (c) 2003-2012 University of Utah and the Flux Group. # Copyright (c) 2003-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -128,7 +128,7 @@ $headuid_email = $leader->email(); ...@@ -128,7 +128,7 @@ $headuid_email = $leader->email();
$headname = $leader->name(); $headname = $leader->name();
SendProjAdminMail( SendProjAdminMail(
$pid, $project,
"ADMIN", "ADMIN",
"$headname '$headuid' <$headuid_email>", "$headname '$headuid' <$headuid_email>",
"Project '$pid' Approval", "Project '$pid' Approval",
......
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