Add e-mail, username, and search root improvements for ActiveDirectory.

Review Request #839 — Created April 27, 2009 and submitted

chipx86
Review Board SVN (deprecated)
891, 908
reviewboard
Add e-mail, username, and search root improvements for ActiveDirectory.

This change makes our ActiveDirectory support more flexible in that we
now use the "mail" field when available for e-mail addresses and we no
longer break when "givenName" or "sn" is not available. This also
introduces a "Custom search root" field in settings for users who need
to fully override the search root.

This change is based on a patch by Ted Dunning, but has been modified to
include siteconfig settings and to break less with mail.

This also fixes the givenName/sn issue on LDAP.
I don't have an ActiveDirectory setup to test. This seems pretty safe, though, and shouldn't cause regressions.
chipx86
david
  1. 
      
  2. /trunk/reviewboard/accounts/backends.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
    user_info is a dict, right?
    
    how about user_info.get()
    1. We could if we just cared about the result of user_info.get('givenName'), but we need to then do [0]. There's no way get() will make our life easier there.
    2. It's not super pretty, but it's less ugly than what you have:
      
      first_name = user_info.get('givenName', [username])[0]
    3. Realized this as I was drifting off to sleep last night. Will have a new diff shortly.
  3. /trunk/reviewboard/accounts/backends.py (Diff revision 1)
     
     
     
    I think settings implements the dictionary protocol, too.
    1. Oops, right. Fixing.
  4. /trunk/reviewboard/accounts/backends.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Also here.
    1. Can't for the same reason above.
  5. 
      
chipx86
Review request changed
david
  1. 
      
  2. 
      
Loading...