Merge pull request #14474 from Godmartinz/asset-location-update-bug

Fixed user assets not updating when a user changes location
This commit is contained in:
snipe 2024-05-15 19:20:14 +01:00 committed by GitHub
commit 55281313d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -62,7 +62,7 @@ class AssetCheckoutController extends Controller
$this->authorize('checkout', $asset);
$admin = Auth::user();
$target = $this->determineCheckoutTarget($asset);
$target = $this->determineCheckoutTarget();
$asset = $this->updateAssetLocation($asset, $target);

View file

@ -293,8 +293,15 @@ class UsersController extends Controller
$user->password = bcrypt($request->input('password'));
}
// Update the location of any assets checked out to this user
Asset::where('assigned_type', User::class)
->where('assigned_to', $user->id)
->update(['location_id' => $user->location_id]);
$permissions_array = $request->input('permission');
// Strip out the superuser permission if the user isn't a superadmin
if (! Auth::user()->isSuperUser()) {
unset($permissions_array['superuser']);