Skip to content

How can I find all groups that reside within a given OU ? #628

Answered by stevebauman
manne65-hd asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @manne65-hd,

I apologize, this isn't clear enough in the documentation, I'll update this.

You have to set the base DN of your query on the Group model like so:

https://ldaprecord.com/docs/core/v3/searching#base-dn

Important: I'm using automatic base DN substitution below which replaces {base} with your connections configured base DN.

use LdapRecord\Models\ActiveDirectory\Group;

$groupsInsideAccounting = Group::in('ou=Accounting,{base}')->get();

Hope this helps! Let me know if you have further questions 👍

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@manne65-hd
Comment options

@stevebauman
Comment options

@HshahLaFarga
Comment options

@stevebauman
Comment options

Answer selected by manne65-hd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants