Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Get all users #798

Open
jberol opened this issue Jan 5, 2022 · 6 comments
Open

Get all users #798

jberol opened this issue Jan 5, 2022 · 6 comments

Comments

@jberol
Copy link

jberol commented Jan 5, 2022

  • Adldap2 Version: #.#
  • LDAP Type:
  • PHP Version: #.#

Description:

Hello,

I can't get the users without the query getting very slow. Is there a way to remove the recursivity to make the query faster? I leave the query code here:

$users = $search->users()->select(['uid', 'mail'])->get();

I have also tried with paginate and the result is the same, because paginate returns all the records.

There are only 2500 users

Thanks.

Steps To Reproduce:

@stevebauman
Copy link
Member

Hi @jberol,

I'd recommend moving to LdapRecord, where you can utilize chunking:

https://ldaprecord.com/docs/core/v2/searching/#chunking

@KarimGeiger
Copy link

Hi @jberol / @stevebauman ,

we are experiencing the same issue and found that the general problem is the way LDAP (and Adldap/LdapRecord) handles paging. It's handled using pointers, so they can always just iterate one page at once, after fetching the next pointer. The pagination therefore is more like a chunking and no real "give me page 4" thing where it just fetches one specific page.

The solution, as far as we could tell, would be to implement the newly (PHP 7.3) added support for VLV (Virtual List View), which implements proper pagination on an LDAP level.

Unfortunately, this seems to be very poorly documented at the moment. The only reference to it we could find is the LDAP_CONTROL_VLVREQUEST constant in the PHP doc and a PHP internal test case that provides a sample implementation.

It looks like neither Adldap nor LdapRecord currently support VLV, so if you only want to access a subset of entries, like we need to, you're SOL :(

@stevebauman
Copy link
Member

stevebauman commented Mar 3, 2022

Hey @KarimGeiger! I had no idea this existed in LDAP. Let me see what I can do in LdapRecord 👍

@KarimGeiger
Copy link

That would be awesome! If you need help testing it, I'd be happy to help. Unfortunately I don't really know enough about LDAP/PHP-LDAP to be of any help with the implementation.

@stevebauman
Copy link
Member

I'll let you know! I'm getting a local Active Directory instance up and running so I'll be able to test with that. Are you on Active Directory as well?

I've created an issue so you can track the status of the implementation here: DirectoryTree/LdapRecord#413

@KarimGeiger
Copy link

Yes, we're on Active Directory as well, and with a lot of records, so we can do some performance testing if need be. Thanks for linking the issue, I'll definitely keep track of it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants