From b221f48e77038a68749f95330bafb3a848d39a6a Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Thu, 24 Apr 2025 18:46:41 -0400 Subject: [PATCH 1/3] remove disband PI --- resources/lib/UnityGroup.php | 82 ++++++++++++++++++------------------ webroot/panel/pi.php | 15 ------- 2 files changed, 41 insertions(+), 56 deletions(-) diff --git a/resources/lib/UnityGroup.php b/resources/lib/UnityGroup.php index d1616225..02b9cbdc 100644 --- a/resources/lib/UnityGroup.php +++ b/resources/lib/UnityGroup.php @@ -198,47 +198,47 @@ public function denyGroup($operator = null, $send_mail = true) } } - /** - * This method will delete the group, either by admin action or PI action - */ - public function removeGroup($send_mail = true) - { - // remove any pending requests - // this will silently fail if the request doesn't exist (which is what we want) - $this->SQL->removeRequests($this->pi_uid); - - // we don't need to do anything extra if the group is already deleted - if (!$this->exists()) { - return; - } - - // first, we must record the users in the group currently - $users = $this->getGroupMembers(); - - // now we delete the ldap entry - $ldapPiGroupEntry = $this->getLDAPPiGroup(); - if ($ldapPiGroupEntry->exists()) { - if (!$ldapPiGroupEntry->delete()) { - throw new Exception("Unable to delete PI ldap group"); - } - - $this->REDIS->removeCacheArray("sorted_groups", "", $this->getPIUID()); - foreach ($users as $user) { - $this->REDIS->removeCacheArray($user->getUID(), "groups", $this->getPIUID()); - } - } - - // send email to every user of the now deleted PI group - if ($send_mail) { - foreach ($users as $user) { - $this->MAILER->sendMail( - $user->getMail(), - "group_disband", - array("group_name" => $this->pi_uid) - ); - } - } - } + // /** + // * This method will delete the group, either by admin action or PI action + // */ + // public function removeGroup($send_mail = true) + // { + // // remove any pending requests + // // this will silently fail if the request doesn't exist (which is what we want) + // $this->SQL->removeRequests($this->pi_uid); + + // // we don't need to do anything extra if the group is already deleted + // if (!$this->exists()) { + // return; + // } + + // // first, we must record the users in the group currently + // $users = $this->getGroupMembers(); + + // // now we delete the ldap entry + // $ldapPiGroupEntry = $this->getLDAPPiGroup(); + // if ($ldapPiGroupEntry->exists()) { + // if (!$ldapPiGroupEntry->delete()) { + // throw new Exception("Unable to delete PI ldap group"); + // } + + // $this->REDIS->removeCacheArray("sorted_groups", "", $this->getPIUID()); + // foreach ($users as $user) { + // $this->REDIS->removeCacheArray($user->getUID(), "groups", $this->getPIUID()); + // } + // } + + // // send email to every user of the now deleted PI group + // if ($send_mail) { + // foreach ($users as $user) { + // $this->MAILER->sendMail( + // $user->getMail(), + // "group_disband", + // array("group_name" => $this->pi_uid) + // ); + // } + // } + // } /** * This method is executed when a user is approved to join the group (either by admin or the group owner) diff --git a/webroot/panel/pi.php b/webroot/panel/pi.php index b9f8db02..df114d51 100644 --- a/webroot/panel/pi.php +++ b/webroot/panel/pi.php @@ -29,11 +29,6 @@ // remove user button clicked $group->removeUser($form_user); - break; - case "disband": - $group->removeGroup(); - UnitySite::redirect($CONFIG["site"]["prefix"] . "/panel/account.php"); - break; } } @@ -110,17 +105,7 @@ } echo ""; - -echo "
Danger Zone
"; - -echo -"
- - -
-"; ?> - Date: Thu, 24 Apr 2025 18:49:34 -0400 Subject: [PATCH 2/3] remove from pi-mgmt as well --- webroot/admin/pi-mgmt.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/webroot/admin/pi-mgmt.php b/webroot/admin/pi-mgmt.php index bb13b828..080c7317 100644 --- a/webroot/admin/pi-mgmt.php +++ b/webroot/admin/pi-mgmt.php @@ -26,11 +26,6 @@ $group->denyGroup($OPERATOR); } - break; - case "remGroup": - $remGroup = new UnityGroup($_POST["pi"], $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK); - $remGroup->removeGroup(); - break; case "reqChild": $parent_group = new UnityGroup($_POST["pi"], $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK); From e04875488a089f204668b1b9d45b5a23b83b0689 Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Thu, 24 Apr 2025 18:52:27 -0400 Subject: [PATCH 3/3] remove remove button --- webroot/admin/pi-mgmt.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/webroot/admin/pi-mgmt.php b/webroot/admin/pi-mgmt.php index 080c7317..c12878dd 100644 --- a/webroot/admin/pi-mgmt.php +++ b/webroot/admin/pi-mgmt.php @@ -123,15 +123,6 @@ " " . $pi_user->getLastname() . ""; echo "" . $pi_group->getPIUID() . ""; echo "" . $pi_user->getMail() . ""; - echo ""; - echo - "
- - - -
"; - echo ""; echo ""; } ?>