By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,818 Members | 1,003 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,818 IT Pros & Developers. It's quick & easy.

ldap search

P: 107
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:

Expand|Select|Wrap|Line Numbers
  1.  function getDetail($objectguid, $Field){
  3.   $filter = "objectguid=$objectguid";
  4.   $fields = array($Field);
  6.   $ldapSearch = ldap_search($this->Connection, $this->baseDomainName, $filter, $fields);
  8.   $ldapResults = ldap_get_entries($this->Connection, $ldapSearch);
  10.   if ($ldapResults['count'] > 0){
  11.     array_shift($ldapResults[0][$Field]);
  12.     return $ldapResults[0][$Field];
  13.   }
  14.   else
  15.     return false;
  16. }

I would run something like:
Expand|Select|Wrap|Line Numbers
  1. $mygroups = getDetail($myGuid, "memberof")
  3. 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.


Sep 3 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.