Skip to content

A free open source IT asset/license management system

updates all assets assigned to user with new location

Godfrey M595dad0f18c0
diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php
index 05f60ee4e1..5b7a59f32b 100755
--- a/app/Console/Commands/LdapSync.php
+++ b/app/Console/Commands/LdapSync.php
@@ -2,6 +2,7 @@
namespace App\Console\Commands;
+use App\Models\Asset;
use App\Models\Department;
use App\Models\Group;
use Illuminate\Console\Command;
@@ -390,6 +391,10 @@ class LdapSync extends Command
$user->location_id = $location->id;
}
}
+ $assets = Asset::whereColumn('assigned_to', '=', $user->id)->get();
+ foreach($assets as $asset){
+ $asset->location = $user->location_id;
+ }
$user->ldap_import = 1;