[support] Drupal 7 query LDAP tokens

Chad chadtrh at gmail.com
Wed Dec 28 15:18:01 UTC 2011


Hello all,

I am fairly new to Drupal, so this may be a simple thing that I am just not
doing right.  I apologize for what will be a long winded email, but I want
to make sure I explain it right.  Here goes:

I am using Drupal 7 with LDAP 7.x-1.0-beta5 (latest stable as of 12/27/11)
and would like to use an attribute in LDAP as a variable for a URL.  I have
Drupal attached to my LDAP server (W2K3 AD) and I can run the manual "test"
query on the AD server and see the list of attributes it pulls back
(Configuration -> LDAP configuration -> Servers -> Test -> test).  It looks
something like:

objectclass    0    top                              [objectclass:0]
objectclass    1    person                         [objectclass:1]
objectclass    2    organizationalPerson     [objectclass:2]
objectclass    3    user                            [objectclass:last]
<snip>
mail              0    john.doe at email.com     [mail]
displayname  0    john doe                       [displayname]
usncreated    0    37151                           [usncreated]
info               0    John.Doe.foo                 [info]


So when I create my link I use something along the lines of:

>     https://www.mysite.com/field1=[current-user:mail]

And when the user clicks the link it resolves to:

>     https://www.mysite.com/field1=john.doe@email.com

That is exactly what I want it to do, but the trick is I want to use the
[info] token from LDAP rather than the [mail] token from the local user
database.  If I do as the documentation says (http://drupal.org/node/1245736)
and change the link with using [info] it looks like:

>     https://www.mysite.com/field1=[info]

Then when the user clicks the link it still shows:

>     https://www.mysite.com/field1=[info]

This is where I would expect it to resolve to '
https://www.mysite.com/field1=John.Doe.foo'

Now this isn't just happing with [info] most of the others don't work
either.  I even tried [cn] which is specifically listed on their example,
but that doesn't work etiher.  Now I am just guessing at ways to pull this
token down. I have tried using:

[current-user:info]
[current-user:ldap:info]
[ldap:info]
[info]

And none of those will resolve to anything.

This is all without the 'token' module being enabled.  I have played with
that, and if I do enable that module I can see that there is a
[current-user:mail] token showing.  However, it doesn't seem to pull
anything from LDAP at all.  I have been able to get this working when I am
using the CAS module and CAS Attributes, but my production box will not
have CAS available so I can't use that one.  But for sake of giving too
much information the link looks like this when it works with CAS:

>     https://www.mysite.com/field1=[current-user:cas:ldap:info]

So that leads me to my short question:

How do I properly pull a token from LDAP to pass into a URL?


Thanks in advance,
Chad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20111228/43c65044/attachment-0001.html 


More information about the support mailing list