Add LDAPBackend

Review Request #16 — Created May 20, 2007 and submitted

Information

Review Board SVN (deprecated)

Reviewers

This patch adds an LDAPBackend class to accounts/backends.py,
to allow Review Board to get its authentication information
from an LDAP server.

It requires the python-ldap package.

Usage: 

LDAP_URI = 'ldap://ldap.example.com:389
LDAP_UID_MASK = 'uid=%s,ou=users,dc=example,dc=com'
LDAP_ANON_BIND_UID = ''
LDAP_ANON_BIND_PASSWD = ''
LDAP_EMAIL_DOMAIN = 'example.com'
AUTHENTICATION_BACKENDS = ('accounts.backends.LDAPBackend', 'django.contrib.auth.backends.ModelBackend') 
It works locally for me; users Review Board hasn't seen before
are successfully authenticated against LDAP.
chipx86
  1. Oops, didn't realize /r/14 was discarded.
  2. trunk/reviewboard/accounts/backends.py (Diff revision 1)
     
     
    Excess whitespace.
  3. trunk/reviewboard/accounts/backends.py (Diff revision 1)
     
     
    Excess whitespace.
  4. Looks good as far as I can tell.
    
    In the future, you'll want to keep only one review request for the change and not publish until everything's updated, or discard it when you want to make changes. I know that's not necessarily clear the first time you use it though.
    
    Thanks for the patch!
david
  1. Just one change I'd like to see.
  2. trunk/reviewboard/accounts/backends.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    We can make this a bit more compact.  Instead of
    
    user = self.get_or_create_user(username)
    
    do this:
    
    return self.get_or_create_user(username)
    
    Then delete the "user = None" and "return user" lines at the beginning and end of the function.  If there's no return statement, python will give us None as the result.
    
    I've updated the NISBackend to do this.  See http://reviewboard.chipx86.com/r/18/
    1. OK, done. I've uploaded the new diff.
      
      I've also gotten rid of the excess whitespace.
      
      Thanks for the comments.
  3. 
      
david
  1. Looks great.  Are you fine with me committing this to SVN?
    1. Are you asking me? I'd be delighted :-)
    2. OK, it's in.  Thanks for doing this!
      
      Feel free to "Set Submitted" on this review at any time.
  2. 
      
Loading...