DirectoryTree / LdapRecord-Discussions

A place to ask questions, get help, or share what you've built with LdapRecord.
4 stars 1 forks source link

Retrieving all groups from AD #6

Closed dbiljak closed 4 years ago

dbiljak commented 4 years ago

Is there an easier way o retrieve all groups from AD (including OU-s and CN-s).

I know there is a Adldap::search()->ous()->get() and Adldap::search()->groups()->get()

that above was from adldap2

looking for something easier

stevebauman commented 4 years ago

Hi @dbiljak,

Yup absolutely, this is actually shown in the documentation site as well:

https://ldaprecord.com/docs/common-queries/

// Retrieve all OU's:
$ous = \LdapRecord\Models\ActiveDirectory\OrganizationalUnit::paginate();

// Retrieve all groups:
$groups = \LdapRecord\Models\ActiveDirectory\Group:: paginate();

Note: I call the paginate() method above instead of get() to avoid hitting the maximum 1000 return limit.

dbiljak commented 4 years ago

Great, thnx for quick reply.

stevebauman commented 4 years ago

Happy to help @dbiljak! 😄