mirror of
https://github.com/snipe/snipe-it.git
synced 2025-12-01 11:30:10 +00:00
Fix asset creation with API and FullMultipleCompanySupport
It is currently possible to create an asset with arbitrary company without being superuser and FullMultipleCompanySupport enabled.
This bug goes back to 75ac7f80b9 which is part of version 6.3.0.
Fix this by restoring the previous behaviour to check the company_id with getIdForCurrentUser().
This commit is contained in:
@ -598,6 +598,7 @@ class AssetsController extends Controller
|
||||
$asset->model()->associate(AssetModel::find((int) $request->get('model_id')));
|
||||
|
||||
$asset->fill($request->validated());
|
||||
$asset->company_id = Company::getIdForCurrentUser($request->validated()['company_id']);
|
||||
$asset->created_by = auth()->id();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user