3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-02-08 08:55:37 +00:00

Merge pull request #14441 from Godmartinz/ldap_location-resync

Fixes Assets location not being resynced when Users location is updated via LDAP
This commit is contained in:
snipe
2024-11-12 22:35:11 +00:00
committed by GitHub

View File

@ -2,6 +2,7 @@
namespace App\Console\Commands;
use App\Models\Asset;
use App\Models\Department;
use App\Models\Group;
use Illuminate\Console\Command;
@ -418,6 +419,8 @@ class LdapSync extends Command
if ($item['createorupdate'] === 'created' && $ldap_default_group) {
$user->groups()->attach($ldap_default_group);
}
//updates assets location based on user's location
Asset::where('assigned_to', '=', $user->id)->update(['location_id' => $user->location_id]);
} else {
foreach ($user->getErrors()->getMessages() as $key => $err) {