Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions lib/adLDAP/classes/adLDAPGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,32 @@ public function removeUser($group, $user, $isGUID = false) {
}
return true;
}

/**
* Remove all users from a group
*
* @param string $group The group to remove users from
* @return bool
*/
public function removeAllUsers($group) {
// Find parent and user distinguished names
$groupInfo = $this->info($group, array("member"));
if ($groupInfo[0]["dn"] === NULL || $groupInfo[0]["member"] === NULL) {
return false;
}

$groupDn = $groupInfo[0]["dn"];

unset($groupInfo[0]['member']['count']);

foreach ($groupInfo[0]["member"] as $member) {
$result = @ldap_mod_del($this->adldap->getLdapConnection(), $groupDn, array('member'=>$member));
if ($result == false) {
return false;
}
}
return true;
}

/**
* Remove a contact from a group
Expand Down