I need to get some user attributes from Active Directory via ldap query. I'm using this code:
$attributes=array("cn","sAMAccountName","sn","givenname","memberof","mail","telephonenumber","mobile","useraccountcontrol","department");
$filter = "(&(objectClass=user)(sAMAccountName=".$username."))";
$result = ldap_search($ldaphandler, $domain, $filter, $attributes);
I need all nested groups, but with this query I get only the first-level group (memberof field). But for instance if a users is member of InnerGroup and InnerGroup is member of OuterGroup I would like to get both groups (InnerGroup and OuterGroup). Is it possibile?
Thank you.