+ Post New Thread
Results 1 to 2 of 2
Web Development Thread, LDAP memberof attribute in Coding and Web Development; Having a hard time with the memberof attribute of PHP LDAP. Got a little snippet like: PHP Code: foreach ( $result ...
  1. #1

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241

    LDAP memberof attribute

    Having a hard time with the memberof attribute of PHP LDAP.

    Got a little snippet like:

    PHP Code:
    foreach ($result[0][memberof] as $group) {
    echo 
    $group.'<br />';

    Obviously that comes after the other LDAP search bumf.

    This shows the groups for some users (such as me), but not other users. I'm sure I've heard memberof can be a bit tricky so is there any better way to see if a user is in a group?

  2. #2

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241
    Okay - figured this out.

    1) Bind user to LDAP, which tells us whether this username/password is correct
    2) For each group we need to check, loop through the group in LDAP and get a list of members for each
    3) Loop through the list of members for each group to see if the username matches any in the list.

    Plenty of code this method but at least it works

SHARE:
+ Post New Thread

Similar Threads

  1. Attribute Editor tab missing in AD
    By RabbieBurns in forum Windows Server 2008 R2
    Replies: 5
    Last Post: 23rd May 2013, 10:48 AM
  2. Replies: 3
    Last Post: 16th September 2009, 01:22 PM
  3. LDAP? What is It? why do I need it? How can I use it?
    By mossj in forum Web Development
    Replies: 6
    Last Post: 7th July 2009, 04:56 PM
  4. LDAP
    By Hightower in forum How do you do....it?
    Replies: 10
    Last Post: 20th June 2008, 12:28 AM
  5. Watch out for the MemberOf gotcha
    By ajbritton in forum Scripts
    Replies: 0
    Last Post: 15th August 2007, 04:15 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •