mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
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:
commit
55281313d8
|
@ -62,7 +62,7 @@ class AssetCheckoutController extends Controller
|
||||||
$this->authorize('checkout', $asset);
|
$this->authorize('checkout', $asset);
|
||||||
$admin = Auth::user();
|
$admin = Auth::user();
|
||||||
|
|
||||||
$target = $this->determineCheckoutTarget($asset);
|
$target = $this->determineCheckoutTarget();
|
||||||
|
|
||||||
$asset = $this->updateAssetLocation($asset, $target);
|
$asset = $this->updateAssetLocation($asset, $target);
|
||||||
|
|
||||||
|
|
|
@ -293,8 +293,15 @@ class UsersController extends Controller
|
||||||
$user->password = bcrypt($request->input('password'));
|
$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');
|
$permissions_array = $request->input('permission');
|
||||||
|
|
||||||
|
|
||||||
// Strip out the superuser permission if the user isn't a superadmin
|
// Strip out the superuser permission if the user isn't a superadmin
|
||||||
if (! Auth::user()->isSuperUser()) {
|
if (! Auth::user()->isSuperUser()) {
|
||||||
unset($permissions_array['superuser']);
|
unset($permissions_array['superuser']);
|
||||||
|
|
Loading…
Reference in a new issue