Add LDAPBackend

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


Review Board SVN (deprecated)


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

It requires the python-ldap package.


LDAP_URI = 'ldap://
LDAP_UID_MASK = 'uid=%s,ou=users,dc=example,dc=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.
  1. Oops, didn't realize /r/14 was discarded.
  2. trunk/reviewboard/accounts/ (Diff revision 1)
    Excess whitespace.
  3. trunk/reviewboard/accounts/ (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!
  1. Just one change I'd like to see.
  2. trunk/reviewboard/accounts/ (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
    1. OK, done. I've uploaded the new diff.
      I've also gotten rid of the excess whitespace.
      Thanks for the comments.
  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.