Fixes 8472 (again) - LDAP sync was assigning a bad default location (#8846)

This commit is contained in:
Brady Wetherington 2020-12-01 21:26:52 -08:00 committed by GitHub
parent 4ac15daee7
commit 34d5473553
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ class LdapSync extends Command
} }
/* Determine which location to assign users to by default. */ /* Determine which location to assign users to by default. */
$location = NULL; $location = NULL; // FIXME - this would be better called "$default_location", which is more explicit about its purpose
if ($this->option('location')!='') { if ($this->option('location')!='') {
$location = Location::where('name', '=', $this->option('location'))->first(); $location = Location::where('name', '=', $this->option('location'))->first();
@ -106,8 +106,8 @@ class LdapSync extends Command
$ldap_ou_locations = Location::where('ldap_ou', '!=', '')->get()->toArray(); $ldap_ou_locations = Location::where('ldap_ou', '!=', '')->get()->toArray();
$ldap_ou_lengths = array(); $ldap_ou_lengths = array();
foreach ($ldap_ou_locations as $location) { foreach ($ldap_ou_locations as $ou_loc) {
$ldap_ou_lengths[] = strlen($location["ldap_ou"]); $ldap_ou_lengths[] = strlen($ou_loc["ldap_ou"]);
} }
array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations); array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations);