Jump to content

Recommended Posts

Posted

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

 

Got a little snippet like:

 

foreach ($result[0][memberof] as $group) {
echo $group.'
';
}

 

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?

Posted

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 :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...