fixed problems with deleting home directories and quotas (913552)

This commit is contained in:
Roland Gruber 2004-03-18 13:11:05 +00:00
parent 8aa92714c8
commit 6f25d6191a
1 changed files with 13 additions and 9 deletions

View File

@ -132,11 +132,11 @@ if ($_POST['delete_yes']) {
echo "</b></legend>\n"; echo "</b></legend>\n";
break; break;
} }
// Store kind of DNs
echo '<input name="type" type="hidden" value="'.$_POST['type'].'">'; echo '<input name="type" type="hidden" value="'.$_POST['type'].'">';
echo "<br><table border=0 >\n"; echo "<br><table border=0 >\n";
// Store kind of DNs
foreach ($delete_dn as $dn) {
// Loop for every DN which should be deleted // Loop for every DN which should be deleted
foreach ($delete_dn as $dn) {
switch ($_POST['type']) { switch ($_POST['type']) {
case 'user': case 'user':
// Get username from DN // Get username from DN
@ -153,6 +153,12 @@ if ($_POST['delete_yes']) {
// *** fixme add error-message if memberUid couldn't be deleted // *** fixme add error-message if memberUid couldn't be deleted
$entry = ldap_next_entry($ldap_intern->server(), $entry); $entry = ldap_next_entry($ldap_intern->server(), $entry);
} }
if ($config_intern->scriptServer && isset($username)) {
// Remove homedir if required
if ($_POST['f_rem_home']) remhomedir($username);
// Remove quotas if lamdaemon.pl is used
remquotas($username, 'user');
}
// Delete user itself // Delete user itself
$success = ldap_delete($ldap_intern->server(), $dn); $success = ldap_delete($ldap_intern->server(), $dn);
if (!$success) $error = _('Could not delete user:').' '.$dn; if (!$success) $error = _('Could not delete user:').' '.$dn;
@ -178,18 +184,16 @@ if ($_POST['delete_yes']) {
// Print error if still users in group // Print error if still users in group
if (!$result) $error = _('Could not delete group. Still users in group:').' '.$dn; if (!$result) $error = _('Could not delete group. Still users in group:').' '.$dn;
else { else {
// Remove quotas if lamdaemon.pl is used
if ($config_intern->scriptServer && isset($groupname)) {
remquotas($groupname, 'group');
}
// Delete group itself // Delete group itself
$success = ldap_delete($ldap_intern->server(), $dn); $success = ldap_delete($ldap_intern->server(), $dn);
if (!$success) $error = _('Could not delete group:').' '.$dn; if (!$success) $error = _('Could not delete group:').' '.$dn;
} }
break; break;
} }
if ($config_intern->scriptServer && isset($usernames)) {
// Remove homedir if required
if ($_POST['f_rem_home']) remhomedir($usernames);
// Remove quotas if lamdaemon.pl is used
remquotas($usernames, 'user');
}
// Remove DNs from cache-array // Remove DNs from cache-array
if ($success && isset($_SESSION[$_POST['type'].'DN'][$dn])) unset($_SESSION[$_POST['type'].'DN'][$dn]); if ($success && isset($_SESSION[$_POST['type'].'DN'][$dn])) unset($_SESSION[$_POST['type'].'DN'][$dn]);
// Display success or error-message // Display success or error-message