You are here

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

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

Is a user a member of group?

Parameters

string $group_dn: MIXED CASE.

mixed $user:

  • drupal user object (stdClass Object)

    • ldap entry of user (array)
    • ldap dn of user (array)
    • drupal user name (string)

enum $nested: = NULL (default to server configuration), TRUE, or FALSE indicating to test for nested groups.

Return value

bool

File

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

Class

LdapServer
LDAP Server Class.

Code

public function groupIsMember($group_dn, $user, $nested = NULL) {
  $nested = $nested === TRUE || $nested === FALSE ? $nested : $this->groupNested;
  $group_dns = $this
    ->groupMembershipsFromUser($user, 'group_dns', $nested);

  // While list of group dns is going to be in correct mixed case, $group_dn may not since it may be derived from user entered values
  // so make sure in_array() is case insensitive.
  return is_array($group_dns) && in_array(drupal_strtolower($group_dn), $this
    ->dnArrayToLowerCase($group_dns));
}