Skip to content

A free open source IT asset/license management system

works fully, just needs to restrict editing for non template creator

akemidxc5284ed19581
diff --git a/app/Http/Requests/UpdateSharedTemplateRequest.php b/app/Http/Requests/UpdateSharedTemplateRequest.php
index 0f56941e81..ada9ca3c92 100644
--- a/app/Http/Requests/UpdateSharedTemplateRequest.php
+++ b/app/Http/Requests/UpdateSharedTemplateRequest.php
@@ -2,7 +2,6 @@
namespace App\Http\Requests;
-use App\Http\Requests\Traits\MayContainCustomFields;
use App\Models\ReportTemplate;
use App\Models\Setting;
use Illuminate\Support\Facades\Gate;
@@ -10,7 +9,6 @@ use Illuminate\Validation\Rule;
class UpdateSharedTemplateRequest extends CustomAssetReportRequest
{
- use MayContainCustomFields;
/**
* Determine if the user is authorized to make this request.
*
@@ -18,7 +16,7 @@ class UpdateSharedTemplateRequest extends CustomAssetReportRequest
*/
public function authorize()
{
- return Gate::allows('view', $this->id); //wait, no we always have the ability to view, we need to restrict on the rules
+ return Gate::allows('edit', $this->id);
}
/**
@@ -28,17 +26,14 @@ class UpdateSharedTemplateRequest extends CustomAssetReportRequest
*/
public function rules()
{
- $setting = Setting::getSettings(); //probably don't need this
-
$rules = array_merge(
parent::rules(),
(new ReportTemplate)->getRules(),
- [
- if ($this->created_by == auth()->id()) //so how do we apply this rule. is it allow or restrict?
-
- ],
- )
-
+ [
+ if ($this->created_by == auth()->id()) {
+ } //so how do we apply this rule. is it allow or restrict?
+ ],
+ );
return $rules;
}
}