mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Fixed #4151 - Undefined index: samaccountname on LDAP import
This commit is contained in:
parent
3a0f738fb0
commit
75032def9e
|
@ -128,17 +128,23 @@ class LdapSync extends Command
|
||||||
$location_users = Ldap::findLdapUsers($ldap_loc["ldap_ou"]);
|
$location_users = Ldap::findLdapUsers($ldap_loc["ldap_ou"]);
|
||||||
$usernames = array();
|
$usernames = array();
|
||||||
for ($i = 0; $i < $location_users["count"]; $i++) {
|
for ($i = 0; $i < $location_users["count"]; $i++) {
|
||||||
|
|
||||||
|
if (array_key_exists($ldap_result_username, $location_users[$i])) {
|
||||||
$location_users[$i]["ldap_location_override"] = true;
|
$location_users[$i]["ldap_location_override"] = true;
|
||||||
$location_users[$i]["location_id"] = $ldap_loc["id"];
|
$location_users[$i]["location_id"] = $ldap_loc["id"];
|
||||||
$usernames[] = $location_users[$i][$ldap_result_username][0];
|
$usernames[] = $location_users[$i][$ldap_result_username][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Delete located users from the general group.
|
// Delete located users from the general group.
|
||||||
foreach ($results as $key => $generic_entry) {
|
foreach ($results as $key => $generic_entry) {
|
||||||
|
if ((is_array($generic_entry)) && (array_key_exists($ldap_result_username, $generic_entry))) {
|
||||||
if (in_array($generic_entry[$ldap_result_username][0], $usernames)) {
|
if (in_array($generic_entry[$ldap_result_username][0], $usernames)) {
|
||||||
unset($results[$key]);
|
unset($results[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$global_count = $results['count'];
|
$global_count = $results['count'];
|
||||||
$results = array_merge($location_users, $results);
|
$results = array_merge($location_users, $results);
|
||||||
|
|
Loading…
Reference in a new issue