Tags:
create new tag
view all tags

Question

I have LdapContrib and LdapNgPlugin installed and working properly. My LDAP users successfully login and their loginnames are properly mapped to WikiNames and their UserTopics. The documentation for LdapNgPlugin includes a reference to "filter" in the LDAP syntax, but there are no examples given and no options or other descriptions of how to use the filter parameter.

I am able to use LDAP{} to create a list of all LDAP users. But I want to filter that (list? search?) so that only those users with an email address in their record will be listed. I am able to get the email address from the directory record with either $mail in LDAP{} or $emails in LDAPUSERS{}.

Environment

TWiki version: TWikiRelease04x02x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Mac OS X 10.5
Web server: Apache 2.2
Perl version:  
Client OS: Mac OS X 10.5
Web Browser: Safari, Firefox
Categories: Documentation, Plugins

-- DavidWolfe - 13 May 2008

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Really? Nobody knows how filter works?

-- DavidWolfe - 12 Jun 2008

The filter parameter to %LDAP{}% is an LDAP search filter. Have a look at RFC1558 for a full definition. There are a couple of easier tutorials and quick-starters for LDAP search filters on the net as well.

Filtering for an attribute to be present can be done using something like (mail=*).

-- MichaelDaum - 13 Jun 2008

Wow! That worked great Michael. Thank you!

So here is my final LDAP search

%LDAP{"(objectClass=posixAccount)" 
  filter="(mail=*)" 
  base="(cn=users)"
  limit="0" 
  header="| *Name* | *Mail* | *iChat* |$n" 
  format="| $cn | $mail | $apple-imhandle |" 
  footer="$n<br/><font color='red'>$count users</font>" 
  sort="cn"
}%

Which works great and results in this (simulated):

Name Mail iChat
Joe Know jknow@domain.com jknow@chat.domain.com
Sue Smith ssmith@domain.com ssmith@chat.domain.com
Tom Jones tjones@domain.com tjones@chat.domain.com

I have another:

%LDAPUSERS{hideunknown="off" header=" | *WikiName* | *username* | *Email* | $n" sep="$n" format=" | $displayName | $loginName | $emails | "}%

That also works great and results in (simulated):

WikiName username Email
JoeKnow jknow jknow@domain.com
SueSmith ssmith ssmith@domain.com
TomJones tjones tjones@domain.com

I cannot find a way to get both WikiName AND Instant Message account in the same listing. As far as I can tell, LDAP can retrieve the apple-imhandle field of the records, but LDAPUSERS cannot. And LDAPUSERS can retrieve (or create) the WikiName, but LDAP cannot.

I can call one command from within the format of the other and get the needed information. But when I try that, EVERY record is retrieved into each cell. So, for example

%LDAPUSERS{hideunknown="off" header=" | *WikiName* | *username* | *Email* | *IM* | $n" sep="$n" format=" | $displayName | $loginName | $emails | %LDAP{format="$apple-imhandle"}% | "}%

results in (simulated): That also works great and results in (simulated):

WikiName username Email IM
JoeKnow jknow jknow@domain.com jknow@chat.domain.com ssmith@chat.domain.com tjones@chat.domain.com
SueSmith ssmith ssmith@domain.com jknow@chat.domain.com ssmith@chat.domain.com tjones@chat.domain.com
TomJones tjones tjones@domain.com jknow@chat.domain.com ssmith@chat.domain.com tjones@chat.domain.com

Is there a way to get a single list with:

  • WikiName
  • Email Address
  • Instant Message account
from LDAP?

-- DavidWolfe - 13 Jun 2008

Sorry, closing this after more than 30 days of inactivity. Please feel free to re-open if needed.

-- PeterThoeny - 07 Nov 2008

Change status to:
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2008-11-07 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.