You are here

public function LdapGroupManager::groupRemoveGroup in Lightweight Directory Access Protocol (LDAP) 8.4

Remove a group entry.

Functionality is not in use, only called by server test form.

@todo When actually in use split into two to remove boolean modifier.

Parameters

string $group_dn: Group DN as LDAP dn.

bool $only_if_group_empty: TRUE = group should not be removed if not empty FALSE = groups should be deleted regardless of members.

Return value

bool Removal result.

File

ldap_servers/src/LdapGroupManager.php, line 155

Class

LdapGroupManager
LDAP Group Manager.

Namespace

Drupal\ldap_servers

Code

public function groupRemoveGroup(string $group_dn, bool $only_if_group_empty = TRUE) : bool {
  if (!$this
    ->checkAvailability()) {
    return FALSE;
  }
  if ($only_if_group_empty) {
    $members = $this
      ->groupAllMembers($group_dn);
    if (!empty($members)) {
      return FALSE;
    }
  }
  return $this
    ->deleteLdapEntry($group_dn);
}