mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Tidying some of the LDAP UDN logic
This commit is contained in:
parent
f64382aa00
commit
4b84a0c916
|
@ -77,6 +77,7 @@ class Ldap extends Model
|
||||||
$connection = Ldap::connectToLdap();
|
$connection = Ldap::connectToLdap();
|
||||||
$ldap_username_field = $settings->ldap_username_field;
|
$ldap_username_field = $settings->ldap_username_field;
|
||||||
$baseDn = $settings->ldap_basedn;
|
$baseDn = $settings->ldap_basedn;
|
||||||
|
$userDn = $ldap_username_field.'='.$username.','.$settings->ldap_basedn;
|
||||||
|
|
||||||
if ($settings->is_ad =='1') {
|
if ($settings->is_ad =='1') {
|
||||||
// Check if they are using the userprincipalname for the username field.
|
// Check if they are using the userprincipalname for the username field.
|
||||||
|
@ -85,15 +86,9 @@ class Ldap extends Model
|
||||||
$userDn = $username;
|
$userDn = $username;
|
||||||
} else {
|
} else {
|
||||||
// In case they haven't added an AD domain
|
// In case they haven't added an AD domain
|
||||||
if ($settings->ad_domain == '') {
|
$userDn = ($settings->ad_domain != '') ? $username.'@'.$settings->ad_domain : $username.'@'.$settings->email_domain;
|
||||||
$userDn = $username.'@'.$settings->email_domain;
|
|
||||||
} else {
|
|
||||||
$userDn = $username.'@'.$settings->ad_domain;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
$userDn = $ldap_username_field.'='.$username.','.$settings->ldap_basedn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\Log::debug('Attempting to login using distinguished name:'.$userDn);
|
\Log::debug('Attempting to login using distinguished name:'.$userDn);
|
||||||
|
|
Loading…
Reference in a new issue