From 296c5b7791448e4ba9999a7b0216c7b5343f28f9 Mon Sep 17 00:00:00 2001 From: Anshul Saha Date: Fri, 24 Feb 2023 15:13:40 -0500 Subject: [PATCH 1/3] added alternate role for PI emails --- config/branding/config.ini | 2 ++ resources/init.php | 4 +++- resources/lib/UnityGroup.php | 11 +++++++++++ resources/lib/UnityMailer.php | 10 +++++++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/config/branding/config.ini b/config/branding/config.ini index d339c773..fbe2c999 100644 --- a/config/branding/config.ini +++ b/config/branding/config.ini @@ -49,6 +49,8 @@ admin = "hpc@it.umass.edu" admin_name = "Unity Cluster Admins" sender = "updates@unity.rc.umass.edu" sender_name = "Unity Cluster Updates" +pi_approve_email = "piapproval@umass.edu" +pi_approve_name = "PI Approval" [page] ; which sql objects to use for the content on these pages home = "home" diff --git a/resources/init.php b/resources/init.php index ae52b760..59f47ce3 100644 --- a/resources/init.php +++ b/resources/init.php @@ -66,7 +66,9 @@ $BRANDING["mail"]["support"], $BRANDING["mail"]["support_name"], $BRANDING["mail"]["admin"], - $BRANDING["mail"]["admin_name"] + $BRANDING["mail"]["admin_name"], + $BRANDING["mail"]["pi_approve_email"], + $BRANDING["mail"]["pi_approve_name"] ); // diff --git a/resources/lib/UnityGroup.php b/resources/lib/UnityGroup.php index 72359f80..c182bd13 100644 --- a/resources/lib/UnityGroup.php +++ b/resources/lib/UnityGroup.php @@ -93,6 +93,17 @@ public function requestGroup($send_mail = true) "email" => $this->getOwner()->getMail() ) ); + + $this->MAILER->sendMail( + "pi_approve_email", + "group_request_admin", + array( + "user" => $this->getOwner()->getUID(), + "org" => $this->getOwner()->getOrg(), + "name" => $this->getOwner()->getFullname(), + "email" => $this->getOwner()->getMail() + ) + ); } } diff --git a/resources/lib/UnityMailer.php b/resources/lib/UnityMailer.php index 9d2c728c..e5247663 100644 --- a/resources/lib/UnityMailer.php +++ b/resources/lib/UnityMailer.php @@ -19,6 +19,8 @@ class UnityMailer extends PHPMailer private $MSG_SUPPORT_NAME; private $MSG_ADMIN_EMAIL; private $MSG_ADMIN_NAME; + private $MSG_PI_APPROVAL_EMAIL; + private $MSG_PI_APPROVAL_NAME; public function __construct( $template_dir, @@ -34,7 +36,9 @@ public function __construct( $msg_support_email, $msg_support_name, $msg_admin_email, - $msg_admin_name + $msg_admin_name, + $msg_pi_approval_email, + $msg_pi_approval_name ) { parent::__construct(); $this->isSMTP(); @@ -87,6 +91,8 @@ public function __construct( $this->MSG_SUPPORT_NAME = $msg_support_name; $this->MSG_ADMIN_EMAIL = $msg_admin_email; $this->MSG_ADMIN_NAME = $msg_admin_name; + $this->MSG_PI_APPROVAL_EMAIL = $msg_pi_approval_email; + $this->MSG_PI_APPROVAL_NAME = $msg_pi_approval_name; } public function sendMail($recipients, $template = null, $data = null) @@ -105,6 +111,8 @@ public function sendMail($recipients, $template = null, $data = null) if ($recipients == "admin") { $this->addBCC($this->MSG_ADMIN_EMAIL, $this->MSG_ADMIN_NAME); + } elseif ($recipients == "pi_approve_email") { + $this->addBCC($this->MSG_PI_APPROVAL_EMAIL, $this->MSG_PI_APPROVAL_NAME); } else { if (is_array($recipients)) { foreach ($recipients as $addr) { From 0ee1b744d24e97b53613d3b93922fd2bec8c708d Mon Sep 17 00:00:00 2001 From: Anshul Saha Date: Fri, 24 Feb 2023 17:10:41 -0500 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Hakan Saplakoglu --- config/branding/config.ini | 2 +- resources/init.php | 2 +- resources/lib/UnityGroup.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/branding/config.ini b/config/branding/config.ini index fbe2c999..2d40aa6e 100644 --- a/config/branding/config.ini +++ b/config/branding/config.ini @@ -49,7 +49,7 @@ admin = "hpc@it.umass.edu" admin_name = "Unity Cluster Admins" sender = "updates@unity.rc.umass.edu" sender_name = "Unity Cluster Updates" -pi_approve_email = "piapproval@umass.edu" +pi_approve = "piapproval@umass.edu" pi_approve_name = "PI Approval" [page] ; which sql objects to use for the content on these pages diff --git a/resources/init.php b/resources/init.php index 59f47ce3..bae0959e 100644 --- a/resources/init.php +++ b/resources/init.php @@ -67,7 +67,7 @@ $BRANDING["mail"]["support_name"], $BRANDING["mail"]["admin"], $BRANDING["mail"]["admin_name"], - $BRANDING["mail"]["pi_approve_email"], + $BRANDING["mail"]["pi_approve"], $BRANDING["mail"]["pi_approve_name"] ); diff --git a/resources/lib/UnityGroup.php b/resources/lib/UnityGroup.php index c182bd13..dde43d63 100644 --- a/resources/lib/UnityGroup.php +++ b/resources/lib/UnityGroup.php @@ -95,7 +95,7 @@ public function requestGroup($send_mail = true) ); $this->MAILER->sendMail( - "pi_approve_email", + "pi_approve", "group_request_admin", array( "user" => $this->getOwner()->getUID(), From 5d932a722d531ad67485b383c0a1e7e1b8e6f498 Mon Sep 17 00:00:00 2001 From: Anshul Saha Date: Fri, 24 Feb 2023 17:16:18 -0500 Subject: [PATCH 3/3] keeping pi_approve consistent in UnityMailer.php --- resources/lib/UnityMailer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/UnityMailer.php b/resources/lib/UnityMailer.php index e5247663..90c39414 100644 --- a/resources/lib/UnityMailer.php +++ b/resources/lib/UnityMailer.php @@ -111,7 +111,7 @@ public function sendMail($recipients, $template = null, $data = null) if ($recipients == "admin") { $this->addBCC($this->MSG_ADMIN_EMAIL, $this->MSG_ADMIN_NAME); - } elseif ($recipients == "pi_approve_email") { + } elseif ($recipients == "pi_approve") { $this->addBCC($this->MSG_PI_APPROVAL_EMAIL, $this->MSG_PI_APPROVAL_NAME); } else { if (is_array($recipients)) {