I actually started out like that and in my trouble shooting had stripped them off. You are correct as this now produces the following from my test code, but I am still not getting the groups. Any other ideas on where to look or how to debug?
Array ( [0] => cn=vclimage,ou=group,ou=vcl,o=odu [1] => vclimage ) Array ( [0] => cn=vcladmin,ou=group,ou=vcl,o=odu [1] => vcladmin ) - Gerhard -----Original Message----- From: Josh Thompson [mailto:josh_thomp...@ncsu.edu] Sent: Tuesday, May 18, 2010 2:57 PM To: vcl-dev@incubator.apache.org Subject: Re: Cannot get LDAP grouping to work -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Gerhard, You're almost there. You need to put ()'s around the part of the regular expression that you want to be the name of the group in VCL. I would suggest: for($i = 0; $i < $data[0]['ismemberof']['count']; $i++) { if(preg_match('/^cn=(vcladmin),ou=group,ou=vcl,o=odu$/', $data[0]['ismemberof'][$i], $match) || preg_match('/^cn=(vclimage),ou=group,ou=vcl,o=odu$/', $data[0]['ismemberof'][$i], $match)) If you look at updateEXAMPLE1Groups in the unmodified code, you'll see some examples that have the ()'s in them. preg_match puts the entire matched string into $match[0] and then any sub matches (items surrounded by ()'s) in $match[1] through $match[n]. Josh On Tuesday May 18, 2010, Hartl, Gerhard L. wrote: > Hello all, > > I have been scratching my head for a few weeks now and still cannot get vcl > ldap groups working. I have following the instruction on the mailing list > regarding setting up the ldap.conf and ldapauth.php and while the user is > properly authenticated, the groups do not follow. We are using OpenDS and > the attribute that lists groups that a user is apart of is "ismemberof". > I have pulled out the updateODUGroups function and populated the variables > and find that I do get a match. > > Here is our match statement: > > for($i = 0; $i < $data[0]['ismemberof']['count']; $i++) { > if(preg_match('/^cn=vcladmin,ou=group,ou=vcl,o=odu$/', > $data[0]['ismemberof'][$i], $match) || > preg_match('/^cn=vclimage,ou=group,ou=vcl,o=odu$/', > $data[0]['ismemberof'][$i], $match)) > > This is what $match gets populated with: > > Array ( [0] => cn=vclimage,ou=group,ou=vcl,o=odu ) Array ( [0] => > cn=vcladmin,ou=group,ou=vcl,o=odu ) > > Is there a better way to debug this? I am not sure where it is breaking. > > Gerhard Hartl > Old Dominion University | ODU > - -- - ------------------------------- Josh Thompson Systems Programmer Advanced Computing | VCL Developer North Carolina State University josh_thomp...@ncsu.edu 919-515-5323 my GPG/PGP key can be found at pgp.mit.edu -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkvy4uoACgkQV/LQcNdtPQON+ACfZvEumECLLDrG5AcwkqeIyXdF wbsAn3SKsS4/5p2RG7rZlZigAoLGI2it =X9lN -----END PGP SIGNATURE-----