How can I find all groups that reside within a given OU ? #628
-
Hello there, Currently after setting up a connection to my LDAP (Active Directory) I can use this to get ALL groups ("starting" from my given BASE_DN) $groups = \LdapRecord\Models\ActiveDirectory\Group::get(); But I would like to find a way to get only the groups from a given OU, while still being able to make my connection with a "higher" BASE_DN I guess this will be some "general" query, and I hope someone can give me a hint. Looking forward to your answers, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
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 https://ldaprecord.com/docs/core/v3/searching#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 👍 |
Beta Was this translation helpful? Give feedback.
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
Hope this helps! Let me know if you have further questions 👍