Restrict users asset listing to just assets checked out to users

This commit is contained in:
snipe 2018-07-25 21:40:33 -07:00
parent b267b34762
commit 9618878023

View file

@ -292,7 +292,7 @@ class UsersController extends Controller
{
$this->authorize('view', User::class);
$this->authorize('view', Asset::class);
$assets = Asset::where('assigned_to', '=', $id)->with('model')->get();
$assets = Asset::where('assigned_to', '=', $id)->where('assigned_type', '=', User::class)->with('model')->get();
return (new AssetsTransformer)->transformAssets($assets, $assets->count());
}