Skip to content

Commit 8814abd

Browse files
authored
remove disband PI (#207)
* remove disband PI * remove from pi-mgmt as well * remove remove button
1 parent 5216a1b commit 8814abd

File tree

3 files changed

+41
-70
lines changed

3 files changed

+41
-70
lines changed

resources/lib/UnityGroup.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -198,47 +198,47 @@ public function denyGroup($operator = null, $send_mail = true)
198198
}
199199
}
200200

201-
/**
202-
* This method will delete the group, either by admin action or PI action
203-
*/
204-
public function removeGroup($send_mail = true)
205-
{
206-
// remove any pending requests
207-
// this will silently fail if the request doesn't exist (which is what we want)
208-
$this->SQL->removeRequests($this->pi_uid);
209-
210-
// we don't need to do anything extra if the group is already deleted
211-
if (!$this->exists()) {
212-
return;
213-
}
214-
215-
// first, we must record the users in the group currently
216-
$users = $this->getGroupMembers();
217-
218-
// now we delete the ldap entry
219-
$ldapPiGroupEntry = $this->getLDAPPiGroup();
220-
if ($ldapPiGroupEntry->exists()) {
221-
if (!$ldapPiGroupEntry->delete()) {
222-
throw new Exception("Unable to delete PI ldap group");
223-
}
224-
225-
$this->REDIS->removeCacheArray("sorted_groups", "", $this->getPIUID());
226-
foreach ($users as $user) {
227-
$this->REDIS->removeCacheArray($user->getUID(), "groups", $this->getPIUID());
228-
}
229-
}
230-
231-
// send email to every user of the now deleted PI group
232-
if ($send_mail) {
233-
foreach ($users as $user) {
234-
$this->MAILER->sendMail(
235-
$user->getMail(),
236-
"group_disband",
237-
array("group_name" => $this->pi_uid)
238-
);
239-
}
240-
}
241-
}
201+
// /**
202+
// * This method will delete the group, either by admin action or PI action
203+
// */
204+
// public function removeGroup($send_mail = true)
205+
// {
206+
// // remove any pending requests
207+
// // this will silently fail if the request doesn't exist (which is what we want)
208+
// $this->SQL->removeRequests($this->pi_uid);
209+
210+
// // we don't need to do anything extra if the group is already deleted
211+
// if (!$this->exists()) {
212+
// return;
213+
// }
214+
215+
// // first, we must record the users in the group currently
216+
// $users = $this->getGroupMembers();
217+
218+
// // now we delete the ldap entry
219+
// $ldapPiGroupEntry = $this->getLDAPPiGroup();
220+
// if ($ldapPiGroupEntry->exists()) {
221+
// if (!$ldapPiGroupEntry->delete()) {
222+
// throw new Exception("Unable to delete PI ldap group");
223+
// }
224+
225+
// $this->REDIS->removeCacheArray("sorted_groups", "", $this->getPIUID());
226+
// foreach ($users as $user) {
227+
// $this->REDIS->removeCacheArray($user->getUID(), "groups", $this->getPIUID());
228+
// }
229+
// }
230+
231+
// // send email to every user of the now deleted PI group
232+
// if ($send_mail) {
233+
// foreach ($users as $user) {
234+
// $this->MAILER->sendMail(
235+
// $user->getMail(),
236+
// "group_disband",
237+
// array("group_name" => $this->pi_uid)
238+
// );
239+
// }
240+
// }
241+
// }
242242

243243
/**
244244
* This method is executed when a user is approved to join the group (either by admin or the group owner)

webroot/admin/pi-mgmt.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
$group->denyGroup($OPERATOR);
2727
}
2828

29-
break;
30-
case "remGroup":
31-
$remGroup = new UnityGroup($_POST["pi"], $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK);
32-
$remGroup->removeGroup();
33-
3429
break;
3530
case "reqChild":
3631
$parent_group = new UnityGroup($_POST["pi"], $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK);
@@ -128,15 +123,6 @@
128123
" " . $pi_user->getLastname() . "</td>";
129124
echo "<td>" . $pi_group->getPIUID() . "</td>";
130125
echo "<td><a href='mailto:" . $pi_user->getMail() . "'>" . $pi_user->getMail() . "</a></td>";
131-
echo "<td>";
132-
echo
133-
"<form action='' method='POST'
134-
onsubmit='return confirm(\"Are you sure you want to remove " . $pi_group->getPIUID() . "?\")'>
135-
<input type='hidden' name='form_name' value='remGroup'>
136-
<input type='hidden' name='pi' value='" . $pi_group->getPIUID() . "'>
137-
<input type='submit' value='Remove'>
138-
</form>";
139-
echo "</td>";
140126
echo "</tr>";
141127
}
142128
?>

webroot/panel/pi.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
// remove user button clicked
3030
$group->removeUser($form_user);
3131

32-
break;
33-
case "disband":
34-
$group->removeGroup();
35-
UnitySite::redirect($CONFIG["site"]["prefix"] . "/panel/account.php");
36-
3732
break;
3833
}
3934
}
@@ -110,17 +105,7 @@
110105
}
111106

112107
echo "</table>";
113-
114-
echo "<h5>Danger Zone</h5>";
115-
116-
echo
117-
"<form action='' method='POST' onsubmit='return confirm(\"Are you sure you want to disband your PI group?\")'>
118-
<input type='hidden' name='form_name' value='disband'>
119-
<input type='submit' value='Disband PI Account'>
120-
</form>
121-
";
122108
?>
123-
</table>
124109

125110
<?php
126111
include $LOC_FOOTER;

0 commit comments

Comments
 (0)