Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you need to perform a <strong>paged search operation</strong> to return more data than the default 1000 limit per query. Paged search works so that it still gets 1000 items per query but the server remembers where your search stopped, sends you a <em>cookie</em> and you can use this cookie later for subsequent search requests. The server will then return another 1000 items, and so on, until the server returns empty cookie -> the resultset is complete.</p> <p>This usually takes some amount of code to get all things right. I would recommend that if you plan to do more with ldap take a look at some well-established libraries for php, like <a href="http://adldap.svn.sourceforge.net" rel="nofollow">adLDAP</a> or <a href="https://github.com/Alaneor/AD-X" rel="nofollow">AD-X</a>.</p> <p>As for the search query itself, I recommend going the following way:</p> <ol> <li>You perform a search for all users who have the <code>l</code> attribute filled in: (&amp;(objectcategory=person)(l=*)) (this will also include contact objects - if you don't want this, replace the first part with <code>objectclass=user</code> )</li> <li>You get the values of the <code>l</code> property and do a <em>uniquification</em> of the set, perhaps using the <code>array_unique</code> function.</li> </ol> <p>If you ever decide to use AD-X, this task is a simple few-liner.</p> <pre><code>$link = new ADX\Core\Link( 'domain.com' ); // open connection $link-&gt;bind ('username', 'pass'); // Authenticate // The Task is a configuration object for your search // request - let's configure it $task = new ADX\Core\Task( ADX\Enums\Operation::OpSearch, $link ); $task-&gt;attributes( 'l' ); // Get these attributes $task-&gt;filter( '(&amp;(objectcategory=person)(l=*))' ); // use this search filter // Do the search using paged searching, returning // ALL matching objects $result = $task-&gt;run_paged(); print_r( $result-&gt;unique( 'l' ); // Get all unique 'l' values from the set </code></pre> <p>And if you don't want to use a library then you should definitely take a look at these two functions that make up the paged results searching functionality:</p> <ul> <li><a href="http://www.php.net/manual/en/function.ldap-control-paged-result.php" rel="nofollow">ldap_control_paged_result</a></li> <li><a href="http://www.php.net/manual/en/function.ldap-control-paged-result-response.php" rel="nofollow">ldap_control_paged_result_response</a></li> </ul> <p>I hope this helps! Good luck!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload