Hey Peeps =)
I have a function that returns an active directory users group membership as an array. This code is part of a bigger object, but something like:
I would run something like:
What I want to do though is select all the objectguid's for the groups rather than just their names.
Now I could get the names and loop through them to look up the guid for each one, but im thinking/hoping that there is a way to nest the query like you would with an sql.
So given a user I could run ldap_search and return all that users groups guid's.... if that makes sense.
Any input is a help.
Cheers
Andy
I have a function that returns an active directory users group membership as an array. This code is part of a bigger object, but something like:
Code:
function getDetail($objectguid, $Field){ $filter = "objectguid=$objectguid"; $fields = array($Field); $ldapSearch = ldap_search($this->Connection, $this->baseDomainName, $filter, $fields); $ldapResults = ldap_get_entries($this->Connection, $ldapSearch); if ($ldapResults['count'] > 0){ array_shift($ldapResults[0][$Field]); return $ldapResults[0][$Field]; } else return false; }
I would run something like:
Code:
$mygroups = getDetail($myGuid, "memberof") print_r($mygroups[0]);
What I want to do though is select all the objectguid's for the groups rather than just their names.
Now I could get the names and loop through them to look up the guid for each one, but im thinking/hoping that there is a way to nest the query like you would with an sql.
So given a user I could run ldap_search and return all that users groups guid's.... if that makes sense.
Any input is a help.
Cheers
Andy