mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
Fixed #4923 - invalid check for location object in Ldap Sync
This commit is contained in:
parent
9f3116e4e3
commit
5484b06df8
|
@ -85,6 +85,8 @@ class LdapSync extends Command
|
|||
}
|
||||
|
||||
/* Determine which location to assign users to by default. */
|
||||
$location = NULL;
|
||||
|
||||
if ($this->option('location')!='') {
|
||||
$location = Location::where('name', '=', $this->option('location'))->first();
|
||||
LOG::debug('Location name '.$this->option('location').' passed');
|
||||
|
@ -93,9 +95,8 @@ class LdapSync extends Command
|
|||
$location = Location::where('id', '=', $this->option('location_id'))->first();
|
||||
LOG::debug('Location ID '.$this->option('location_id').' passed');
|
||||
LOG::debug('Importing to '.$location->name.' ('.$location->id.')');
|
||||
} else {
|
||||
$location = NULL;
|
||||
}
|
||||
|
||||
if (!isset($location)) {
|
||||
LOG::debug('That location is invalid or a location was not provided, so no location will be assigned by default.');
|
||||
}
|
||||
|
@ -188,7 +189,7 @@ class LdapSync extends Command
|
|||
|
||||
if ($item['ldap_location_override'] == true) {
|
||||
$user->location_id = $item['location_id'];
|
||||
} else if ($location) {
|
||||
} elseif ((isset($location)) && (!empty($location))) {
|
||||
$user->location_id = e($location->id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue