1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Fall back to LDAP search attribute if username attribute is not configured

Summary:
See discussion in D3340. Some configurations set only a search attribute because their records are indexed by username (this is probably not quite the correct LDAP terminology). Other configurations use one attribute to search and a different attribute to select usernames.

After D3340, installs which set only a search attribute broke. Instead, fall back to the search attribute if no username attribute is present.

Test Plan: Successfully logged in on my test slapd.

Reviewers: yunake, voldern, briancline

Reviewed By: voldern

CC: aran

Differential Revision: https://secure.phabricator.com/D3406
This commit is contained in:
epriestley 2012-09-03 06:41:49 -07:00
parent ada5f81614
commit e3c6dc687a

View file

@ -99,7 +99,10 @@ final class PhabricatorLDAPProvider {
} }
public function retrieveUsername() { public function retrieveUsername() {
return $this->userData[$this->getUsernameAttribute()][0]; $key = nonempty(
$this->getUsernameAttribute(),
$this->getSearchAttribute());
return $this->userData[$key][0];
} }
public function getConnection() { public function getConnection() {