mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Only set manager ID when the lookup succeeds.
This commit is contained in:
parent
cc35a9ab6b
commit
f608e4586c
|
@ -218,8 +218,10 @@ class LdapSync extends Command
|
||||||
$item['manager'] = ltrim($item['manager'], "CN=");
|
$item['manager'] = ltrim($item['manager'], "CN=");
|
||||||
$item['manager'] = substr($item['manager'],0, strpos($item['manager'], ','));
|
$item['manager'] = substr($item['manager'],0, strpos($item['manager'], ','));
|
||||||
$ldap_manager = User::where('username', $item['manager'])->first();
|
$ldap_manager = User::where('username', $item['manager'])->first();
|
||||||
|
if ( $ldap_manager && isset($ldap_manager->id) ) {
|
||||||
$user->manager_id = $ldap_manager->id;
|
$user->manager_id = $ldap_manager->id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Sync activated state for Active Directory.
|
// Sync activated state for Active Directory.
|
||||||
|
|
Loading…
Reference in a new issue