You are here

public function LdapServer::groupRemoveMember in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_servers/LdapServer.class.php \LdapServer::groupRemoveMember()

NOT TESTED remove a member from a group.

Parameters

string $group_dn: as ldap dn.

mixed $user:

  • drupal user object (stdClass Object)

    • ldap entry of user (array) (with top level keys of 'dn', 'mail',

'sid' and 'attr' )

  • ldap dn of user (array)
  • drupal username of user (string)

Return value

bool

File

ldap_servers/LdapServer.class.php, line 1597
Defines server classes and related functions.

Class

LdapServer
LDAP Server Class.

Code

public function groupRemoveMember($group_dn, $user) {
  $user_ldap_entry = $this
    ->userUserToExistingLdapEntry($user);
  $result = FALSE;
  if ($user_ldap_entry && $this->groupGroupEntryMembershipsConfigured) {
    $del = [];
    $del[$this->groupMembershipsAttr] = $user_ldap_entry['dn'];
    $this
      ->connectAndBindIfNotAlready();
    $result = @ldap_mod_del($this->connection, $group_dn, $del);
  }
  return $result;
}