Skip to content

A free open source IT asset/license management system

Only update asset locations to assets checked out to users.

Brady Wetheringtonb5c825153933
diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php
index 2338cebf75..e57fab19ab 100644
--- a/app/Console/Commands/LdapSync.php
+++ b/app/Console/Commands/LdapSync.php
@@ -427,7 +427,7 @@ class LdapSync extends Command
$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]);
+ Asset::where('assigned_to', '=', $user->id)->where('assigned_type', '=', User::class)->update(['location_id' => $user->location_id]);
} else {
foreach ($user->getErrors()->getMessages() as $key => $err) {