Hi, 

For the purpose of demonstration, here's my name_callback. Works the same iirc. 
 

def dc_ad_callback(key):
    def callback(ldap_dict):
        try:
            aliasname = ldap_dict[key][0].decode('utf-8')
            import string
            username = string.capwords(aliasname.replace('-','- ')).replace(' 
','').replace('\'','')
        except KeyError:
            #logging.debug('ldap_dict keys:'+','.join(ldap_dict.keys()))
            username = ldap_dict['givenName'][0]
            if username.lower() == 'someserviceprocess':
                username = 'SomeService' # this service doesn´t match otherwise
        return username
    return callback

Which is then setup as: 
    
    name_callback=dc_ad_callback('displayNamePrintable')

Remco Boerma - Database Administrator & Technisch Applicatie Beheer
ROC Drenthecollege - www.drenthecollege.nl - 088 188 4693 
[email protected] - http://twitter.com/RemcoBoerma

-----Oorspronkelijk bericht-----
Van: Cristian Rigamonti [mailto:[email protected]] 
Verzonden: zaterdag 24 september 2011 20:20
Aan: [email protected]
Onderwerp: [Moin-user] LDAP auth, build email address, email_callback?

Hi, can anyone provide an example of using the email_callback configuration 
option (LDAP authentication section)?

Problem: I don't want to get the mail address straight from LDAP, it should be 
made up of [email protected] (the "mydomain.org" part is fixed for all 
users).

I suspect that email_callback could be used to implement this (other ideas are 
welcome), but I couldn't find documentation about its usage, and reading 
auth/ldap_login.py didn't help that much.

Thanks!

Cri

-- 
GPG/PGP Key-Id 0x943A5F0E      -    http://www.linux.it/~cri/cri.asc
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes sense 
of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Moin-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/moin-user

------------------------------->

Vrijwaring/Disclaimer
De gegevens in dit elektronisch document en de eventuele bijlagen zijn 
uitsluitend bedoeld voor de geadresseerde(n). 
De informatie wordt zorgvuldig samengesteld. 
Het Drenthe College kan echter niet garanderen dat de informatie absoluut 
juist, volledig en tijdig overkomt via het Internet. 
Voor belangrijke beslissingen aangaande de verstrekte informatie dient u een en 
ander rechtstreeks bij het Drenthe College te controleren.

Website van het Drenthe College:
www.drenthecollege.nl

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Moin-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/moin-user

Reply via email to