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:
Tobias Regnery 2024-10-11 12:09:09 +02:00
parent 8aa298f6b0
commit fb4fe30049

View file

@ -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();
/**