Skip to content

A free open source IT asset/license management system

Set company_id in request for non-super-admins when fmcs enabled

Marcus Moore85d7ba73aace
diff --git a/app/Http/Requests/CreateMultipleAssetRequest.php b/app/Http/Requests/CreateMultipleAssetRequest.php
index a33cf36b41..5dbf36dc05 100644
--- a/app/Http/Requests/CreateMultipleAssetRequest.php
+++ b/app/Http/Requests/CreateMultipleAssetRequest.php
@@ -22,6 +22,15 @@ class CreateMultipleAssetRequest extends ImageUploadRequest // should I extend f
return true; // TODO - should I do the auth check here?
}
+ protected function prepareForValidation()
+ {
+ parent::prepareForValidation();
+
+ if (Setting::getSettings()->full_multiple_companies_support == '1' && ! $this->user()->isSuperUser()) {
+ $this->mergeIfMissing(['company_id' => $this->user()->company_id]);
+ }
+ }
+
/**
* Get the validation rules that apply to the request.
*