medofied delete.php to call lamdaemon.pl max. 2 times

Changed Profile Files to support new quota interface
This commit is contained in:
katagia 2003-11-06 11:08:28 +00:00
parent e116aa0893
commit 004cd10cd4
3 changed files with 14 additions and 12 deletions

View File

@ -148,13 +148,8 @@ if ($_POST['delete_yes']) {
// Get username from DN // Get username from DN
$temp=explode(',', $dn); $temp=explode(',', $dn);
$username = str_replace('uid=', '', $temp[0]); $username = str_replace('uid=', '', $temp[0]);
// Fill array with groupnames
if ($config_intern->scriptServer) { $usernames[] = $username;
// Remove homedir if required
if ($_POST['f_rem_home']) remhomedir(array($username));
// Remove quotas if lamdaemon.pl is used
if ($config_intern->scriptServer) remquotas(array($username), 'user');
}
// Search for groups which have memberUid set to username // Search for groups which have memberUid set to username
$result = ldap_search($ldap_intern->server(), $config_intern->get_GroupSuffix(), "(&(objectClass=PosixGroup)(memberUid=$username))", array('')); $result = ldap_search($ldap_intern->server(), $config_intern->get_GroupSuffix(), "(&(objectClass=PosixGroup)(memberUid=$username))", array(''));
$entry = ldap_first_entry($ldap_intern->server(), $result); $entry = ldap_first_entry($ldap_intern->server(), $result);
@ -180,6 +175,8 @@ if ($_POST['delete_yes']) {
*/ */
$temp=explode(',', $dn); $temp=explode(',', $dn);
$groupname = str_replace('cn=', '', $temp[0]); $groupname = str_replace('cn=', '', $temp[0]);
// Fill array with groupnames
$usernames[] = $groupname;
// Get group GIDNumber // Get group GIDNumber
$groupgid = getgid($groupname); $groupgid = getgid($groupname);
// Search for users which have gid set to current gid // Search for users which have gid set to current gid
@ -187,15 +184,18 @@ 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 {
// continue if no primary users are in group
// Remove quotas if lamdaemon.pl is used
if ($config_intern->scriptServer) remquotas(array($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 && is_set($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

View File

@ -42,7 +42,8 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
// load quota list // load quota list
if ($_SESSION['config']->get_scriptPath()) { if ($_SESSION['config']->get_scriptPath()) {
$acct_q = getquotas("group"); $tmp = getquotas("group");
$acct_q = $tmp[0];
} }
// print header // print header

View File

@ -42,7 +42,8 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
// load quota list // load quota list
if ($_SESSION['config']->get_scriptPath()) { if ($_SESSION['config']->get_scriptPath()) {
$acct_q = getquotas("user"); $tmp = getquotas("user");
$acct_q = $tmp[0];
} }
// print header // print header