Add error handling for when LDAP "Full Name Attribute" has no white space.
Review Request #9211 — Created Sept. 23, 2017 and submitted
When setting up LDAP authentication, an uncaught exception may be thrown
when splitting the full name into first name and last name. This happens
when the full name contains no space.If this exception occurs it will now assign the full name to the first
name, and make the last name an empty string.
Because there was a comment just above my changes explaining how full
name is split between first and last name, I added to it to explain what
happens to first and last name in this situation.
I was not able to properly reproduce and test this manually because I
could not get a LDAP server up and running.I have written a unit test that provides the modified function,
get_or_create_user(), with a user that has a full name containing no
spaces and verifies that the first and last name are assigned as
expected.
This test passes with this fix, and fails on 2.5.x without the fix.
Description | From | Last Updated |
---|---|---|
The description looks great, though it needs to wrap to 70-75 characters. I do want to see some testing in … |
|
|
Blank line between these (any time you have a block-creating statement like try, if/else, etc. and another statement). |
|
|
W293 blank line contains whitespace |
![]() |
|
Can we add a blank line (with just a #) between these to separate the paragraphs? |
|
|
Should end in a period. |
|
-
-
The description looks great, though it needs to wrap to 70-75 characters.
I do want to see some testing in here, though. I understand the issue with setting up an LDAP server (no fun), but we do have infrastructure for simulating LDAP connections in our unit tests, so you should at least have a unit test for this (one that fails prior to your fix and succeeds after).
-
reviewboard/accounts/backends.py (Diff revision 1) Blank line between these (any time you have a block-creating statement like
try
,if/else
, etc. and another statement).
Summary: |
|
|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||||||||
Testing Done: |
|
|||||||||||||||||||||||||||||||||
Commit: |
|
|||||||||||||||||||||||||||||||||
Diff: |
Revision 2 (+10 -1) |
Checks run (1 failed, 1 succeeded)
flake8
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+10 -1) |
Checks run (2 succeeded)
Testing Done: |
|
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 4 (+52 -1) |
Checks run (2 succeeded)
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
-
-
reviewboard/accounts/backends.py (Diff revision 4) Can we add a blank line (with just a #) between these to separate the paragraphs?
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+53 -1) |