Tags:
ldap1Add my vote for this tag create new tag
view all tags

Question

In WebHomer1.85 - 15 Aug 2004 (sorry, couldn't match that against the pull-down) we have a page that extracts user-names from an ldap-query. I'd like to know how to strip hypens out of hypenated returned last names so they match the twiki-usernames. I assume it's using formatted searches $pattern somehow, but am worried that I might break stuff.

Cheers, Andrej

Environment

TWiki version: TWikiRelease04x00x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian 3.1, kernel 2.6.12-5
Web server: Apache 2.0.54
Perl version: perl 5.8.4
Client OS:  
Web Browser:  
Categories: Forms

-- AndrejRicnik - 31 Mar 2006

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.

Irc log

Tue Apr 4 2006] [10:04:42] <andrej> Anyone got an idea how I can modify values that come back from an LDAP query within twiki?
[Tue Apr 4 2006] [10:05:11] <andrej> I need to get rid of hyphens in last-names to make the LDAP and twiki names match
[Tue Apr 4 2006] [10:12:39] <andrej> Or maybe a hint as to where inside %LDAP one would be using $pattern() to get rid of the hyphen (like one would in a %SEARCH)
[Tue Apr 4 2006] [10:18:22] <MichaelDaum> basically you should use the uid attributes from the ldap account
[Tue Apr 4 2006] [10:18:25] <MichaelDaum> and not the cn
[Tue Apr 4 2006] [10:18:33] <MichaelDaum> or the displayName
[Tue Apr 4 2006] [10:19:11] <MichaelDaum> and the set the AllowLoginName to true in your twiki installation
[Tue Apr 4 2006] [10:19:27] <MichaelDaum> so that you can map uids to wikinames using the Main.TWikiUsers topic
[Tue Apr 4 2006] [10:37:07] <andrej> MIchael, I thought that twiki-words aren't allowed to have hyphens
[Tue Apr 4 2006] [10:37:42] <MichaelDaum> are you trying to use the LdapPlugin?
[Tue Apr 4 2006] [10:38:22] <andrej> Yes, I am ...
[Tue Apr 4 2006] [10:38:59] <andrej> The query results are fine, I just can't get them to match with the twiki user names
[Tue Apr 4 2006] [10:39:32] <andrej> because the twiki names don't have hyphens (and I was told that they can't) ... I'm not administering twiki, though, just using it
[Tue Apr 4 2006] [10:39:56] <MichaelDaum> you want to construct wikiusernames to have clickable table cells, right?
[Tue Apr 4 2006] [10:40:05] <andrej> Yep
[Tue Apr 4 2006] [10:40:13] <andrej> Well, links of any sort
[Tue Apr 4 2006] [10:40:30] <andrej> Just so that the LDAP name and the twiki names are correlated
[Tue Apr 4 2006] [10:40:41] <MichaelDaum> the LdapPlugin does not provide any means for that problem
[Tue Apr 4 2006] [10:41:06] <MichaelDaum> do you authenticate twiki user accounts against an ldap server?
[Tue Apr 4 2006] [10:41:24] <andrej> I was afraid you'd say that ... I suppose I'll have to hack some perl myself then ;}
[Tue Apr 4 2006] [10:41:31] <MichaelDaum> no
[Tue Apr 4 2006] [10:41:49] <MichaelDaum> you can configure apache to integrate mod_auth_ldap
[Tue Apr 4 2006] [10:41:50] <andrej> Yes, we do authenticate against LDAP
[Tue Apr 4 2006] [10:42:02] <MichaelDaum> ok
[Tue Apr 4 2006] [10:42:37] <MichaelDaum> andrej, do you have AllowLoginName = 1 set in your configuration
[Tue Apr 4 2006] [10:43:18] * andrej has no clue ... as I said, I'm just using twiki, and am in the unfortunate position to have a hyphen in my last name :)
[Tue Apr 4 2006] [10:43:49] <MichaelDaum> what is your login name, what is your wikiusername on your installation?
[Tue Apr 4 2006] [10:44:09] <MichaelDaum> eg. my login name is micha, my wikiusername is MichaelDaum
[Tue Apr 4 2006] [10:44:28] <MichaelDaum> uid=micha is known by the ldap server
[Tue Apr 4 2006] [10:44:32] <andrej> login-name and twiki-username seem to be disjunct. anb vs AndrejR-B
[Tue Apr 4 2006] [10:44:40] <MichaelDaum> aha
[Tue Apr 4 2006] [10:44:57] <MichaelDaum> and does your ldap record have a uid=anb ?
[Tue Apr 4 2006] [10:45:00] <andrej> well, minus the hyphen, which is what ldap returns
[Tue Apr 4 2006] [10:45:06] <andrej> yeah
[Tue Apr 4 2006] [10:45:26] <MichaelDaum> does Main.TWikiUsers list both in a row for your account?
[Tue Apr 4 2006] [10:46:20] <MichaelDaum> eg: * AndrejRB - anb - 03 Jul 2004
[Tue Apr 4 2006] [10:46:34] <andrej> Wish I could check. My employer doesn't permit IRC from the corporate network
[Tue Apr 4 2006] [10:46:46] <andrej> And from home I can't get to our twiki
[Tue Apr 4 2006] [10:49:56] <andrej> Maybe I can call back in tomorrow, or convince my boss to let me use my shell-account via ssh? ;)

Ok. You are looking for a basic string manipulation. Have a look at the %REPLACE and %PROPPER tags of the SpreadSheetPlugin. Nevertheless, you are right, there is no reverse %SPACEOUT. And the LdapPlugin 's format capabilities are sub standard.

-- MichaelDaum - 05 Apr 2006

Thanks for the awsome support Michael, it's greatly appreciated! Is there a simpler plugin than the spreadsheet one that I could utilise? The data that's returned is really just a plain list that we don't format in anyway but adding commas between the names, so there's no tabular data that I may want to be modifiying. Any old means that I can wrap around the query results ... something like s/(\w+)-(\w+)?/$1$2/g should do me just fine smile

Cheers, Andrej

P.S.: I was really impressed to find the irc snippet here, you have a great support team! :}

-- AndrejRicnik - 05 Apr 2006

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2006-04-05 - AndrejRicnik
 
  • 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.