mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge pull request #11510 from sunflowerbofh/tmp-ldap
Fixed #11509 allow-ldap-anonymous-bind
This commit is contained in:
commit
45f17fea8a
|
@ -169,6 +169,7 @@ class Ldap extends Model
|
||||||
{
|
{
|
||||||
$ldap_username = Setting::getSettings()->ldap_uname;
|
$ldap_username = Setting::getSettings()->ldap_uname;
|
||||||
|
|
||||||
|
if ( $ldap_username ) {
|
||||||
// Lets return some nicer messages for users who donked their app key, and disable LDAP
|
// Lets return some nicer messages for users who donked their app key, and disable LDAP
|
||||||
try {
|
try {
|
||||||
$ldap_pass = \Crypt::decrypt(Setting::getSettings()->ldap_pword);
|
$ldap_pass = \Crypt::decrypt(Setting::getSettings()->ldap_pword);
|
||||||
|
@ -184,8 +185,13 @@ class Ldap extends Model
|
||||||
// so I don't want to fix this right now.
|
// so I don't want to fix this right now.
|
||||||
// this method MODIFIES STATE on the passed-in $connection and just returns true or false (or, in this case, undefined)
|
// this method MODIFIES STATE on the passed-in $connection and just returns true or false (or, in this case, undefined)
|
||||||
// at the next refactor, this should be appropriately modified to be more consistent.
|
// at the next refactor, this should be appropriately modified to be more consistent.
|
||||||
|
} else {
|
||||||
|
// LDAP should also work with anonymous bind (no dn, no password available)
|
||||||
|
if (! $ldapbind = @ldap_bind($connection )) {
|
||||||
|
throw new Exception('Could not bind to LDAP: '.ldap_error($connection));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse and map LDAP attributes based on settings
|
* Parse and map LDAP attributes based on settings
|
||||||
|
|
Loading…
Reference in a new issue