wiki:ActiveDirectoryLookupPatch

Version 2 (modified by rjollos, 2 years ago) (diff)

Added maintainer and page outline.

Autofill authenticated user's session settings from Active Directory

Description

This patch adds functionality to retrieve email and name from an Active Directory server for a logged in user if their either their 'Name' and/or 'Email' session settings are blank. Looks for [session] trac.ini flags to enable/disable each.

Dependencies:

NOTE: this patch adds module-level imports in session.py for the two required modules, pywin32 and active_directory. These imports are wrapped inside (1) a platform sanity-check (platform.system() == 'Windows') and (2) each import is within its own try/except. If any of the checks fail, then none of the new code will ever be reached.

Bugs/Feature Requests

Existing bugs and feature requests for ActiveDirectoryLookupPatch are here.

If you have any issues, create a new ticket.

Download, Source

Download the zipped source, check out using Subversion, or browse the source with Trac.

Example

  • install the required modules: pywin32 and active_directory
  • Apply the file patch session_patch.diff to your existing /trac/web/session.py (or just copy (and rename) the provided session_full.py over your existing /trac/web/session.py -- BUT BACKUP YOUR ORIGINAL FIRST!!)
  • Modify your trac.ini file:
    [session]
    ## this setting indicates that if the user hasn't filled 
    ##   in a name on their 'Preferences' page, go try and 
    ##   grab it from the LDAP/AD server (the 'displayName' user property)
    ## defaults:
    ##   get_name_from_ldap_if_empty = false
    ##   get_name_from_ldap_userattribute = displayName
    get_name_from_ldap_if_empty = true
    get_name_from_ldap_userattribute = displayName
    
    ## this setting indicates that if the user hasn't filled 
    ##   in an email on their 'Preferences' page, go try and 
    ##   grab it from the LDAP/AD server (the 'mail' user property)
    ## defaults:
    ##   get_email_from_ldap_if_empty = false
    ##   get_email_from_ldap_userattribute = mail
    get_email_from_ldap_if_empty = true
    get_email_from_ldap_userattribute = mail
    
    

Recent Changes

[6904] by root on 2009-10-28 10:49:45
Renaming per request, see th-users mailing list.
[2561] by gt4329b on 2007-08-10 23:16:28

LdapSessionSettingsPatch:

  • added patch, README, sample ini file
[2560] by gt4329b on 2007-08-10 22:56:45
New hack LdapSessionSettingsPatch, created by gt4329b

Author/Contributors

Author: gt4329b
Maintainer: gt4329b
Contributors: