Skip to content

Commit 787340b

Browse files
authored
Merge pull request #14441 from Godmartinz/ldap_location-resync
Fixes Assets location not being resynced when Users location is updated via LDAP
2 parents 6bec573 + c62a022 commit 787340b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/Console/Commands/LdapSync.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Console\Commands;
44

5+
use App\Models\Asset;
56
use App\Models\Department;
67
use App\Models\Group;
78
use Illuminate\Console\Command;
@@ -418,6 +419,8 @@ public function handle()
418419
if ($item['createorupdate'] === 'created' && $ldap_default_group) {
419420
$user->groups()->attach($ldap_default_group);
420421
}
422+
//updates assets location based on user's location
423+
Asset::where('assigned_to', '=', $user->id)->update(['location_id' => $user->location_id]);
421424

422425
} else {
423426
foreach ($user->getErrors()->getMessages() as $key => $err) {

0 commit comments

Comments
 (0)