You are here

public function SimpleLdap::ldapList in Simple LDAP 8

Wrapper function for ldap_list().

Parameters

string $base_dn: The base DN for the directory.

string $filter: The LDAP filter to apply.

array $attributes: An array of the required attributes.

int $attrsonly: Should be set to 1 if only attribute types are wanted. If set to 0 both attributes types and attribute values are fetched which is the default behaviour.

int $sizelimit: Enables you to limit the count of entries fetched. Setting this to 0 means no limit.

int $timelimit: Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit.

int $deref: Specifies how aliases should be handled during the search.

Return value

resource LDAP search result identifier.

Throws

SimpleLdapException

File

src/SimpleLdap.php, line 368

Class

SimpleLdap
A wrapper for PHP's LDAP functions, with associated helper methods.

Namespace

Drupal\simple_ldap

Code

public function ldapList($base_dn, $filter, $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = NULL) {
  $return = @ldap_list($this->connection
    ->getResource(), $base_dn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $this
    ->getDefaultDeref($deref));
  if ($return === FALSE) {
    throw new SimpleLdapException('ldap_list wrapper: ', $this->connection
      ->getResource());
  }
  return $return;
}