code/services/LDAPService.php
public function getUsers($attributes = [])
    {
        $searchLocations = $this->config()->users_search_locations ?: [null];
        $results = [];

        foreach ($searchLocations as $searchLocation) {
            $records = $this->gateway->getUsers($searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes);
            if (!$records) {
                continue;
            }

            foreach ($records as $record) {
                $results[$record['objectguid']] = $record;
            }
        }

        return $results;
    }
public function getUsers($attributes = [])
    {
        $searchLocations = $this->config()->users_search_locations ?: [null];
        $results = [];

        foreach ($searchLocations as $searchLocation) {
            $records = $this->gateway->getUsers($searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes);
            if (!$records) {
                continue;
            }

            foreach ($records as $record) {
                $results[$record['objectguid']] = $record;
            }
        }

        return $results;
    }
Return all AD users in configured search locations, including all users in nested groups.
Uses users_search_locations if defined, otherwise falls back to NULL, which tells LDAPGateway
to use the default baseDn defined in the connection.

@param array $attributes List of specific AD attributes to return. Empty array means return everything.
@return array