You are here

public function SimpleLdap::ldapRead in Simple LDAP 8

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

\Drupal\simple_ldap\SimpleLdapException

File

src/SimpleLdap.php, line 330

Class

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

Namespace

Drupal\simple_ldap

Code

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