Skip to content

A free open source IT asset/license management system

Updated gate check on presenters

snipe401c83945dd2
diff --git a/app/Presenters/CategoryPresenter.php b/app/Presenters/CategoryPresenter.php
index 46eec96cf5..2b827dae68 100644
--- a/app/Presenters/CategoryPresenter.php
+++ b/app/Presenters/CategoryPresenter.php
@@ -153,7 +153,7 @@ class CategoryPresenter extends Presenter
public function formattedNameLink() {
- if (auth()->user()->can('category.view', $this)) {
+ if (auth()->user()->can('view', ['\App\Models\Category', $this])) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('categories.show', e($this->id)).'">'.e($this->name).'</a>';
}
diff --git a/app/Presenters/CompanyPresenter.php b/app/Presenters/CompanyPresenter.php
index 6ccdf57f50..bbb06bbafc 100644
--- a/app/Presenters/CompanyPresenter.php
+++ b/app/Presenters/CompanyPresenter.php
@@ -178,7 +178,7 @@ class CompanyPresenter extends Presenter
public function formattedNameLink() {
- if (auth()->user()->can('company.view', $this)) {
+ if (auth()->user()->can('view', ['\App\Models\Company', $this])) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('companies.show', e($this->id)).'">'.e($this->name).'</a>';
}
diff --git a/app/Presenters/DepartmentPresenter.php b/app/Presenters/DepartmentPresenter.php
index 54b3fa59c4..6decb8289d 100644
--- a/app/Presenters/DepartmentPresenter.php
+++ b/app/Presenters/DepartmentPresenter.php
@@ -121,7 +121,7 @@ class DepartmentPresenter extends Presenter
public function formattedNameLink() {
- if (auth()->user()->can('department.view', $this)) {
+ if (auth()->user()->can('view', ['\App\Models\Department', $this])) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('departments.show', e($this->id)).'">'.e($this->name).'</a>';
}
diff --git a/app/Presenters/LocationPresenter.php b/app/Presenters/LocationPresenter.php
index de59167207..ab739e871b 100644
--- a/app/Presenters/LocationPresenter.php
+++ b/app/Presenters/LocationPresenter.php
@@ -378,7 +378,7 @@ class LocationPresenter extends Presenter
public function formattedNameLink() {
- if (auth()->user()->can('locations.view', $this)) {
+ if (auth()->user()->can('view', ['\App\Models\Location', $this])) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('locations.show', e($this->id)).'">'.e($this->name).'</a>';
}
diff --git a/app/Presenters/ManufacturerPresenter.php b/app/Presenters/ManufacturerPresenter.php
index 5ae47da53b..e4730adf36 100644
--- a/app/Presenters/ManufacturerPresenter.php
+++ b/app/Presenters/ManufacturerPresenter.php
@@ -194,7 +194,7 @@ class ManufacturerPresenter extends Presenter
public function formattedNameLink() {
- if (auth()->user()->can('manufacturer.view', $this)) {
+ if (auth()->user()->can('view', ['\App\Models\Manufacturer', $this])) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('manufacturers.show', e($this->id)).'">'.e($this->name).'</a>';
}
diff --git a/app/Presenters/SupplierPresenter.php b/app/Presenters/SupplierPresenter.php
index 6bedcafa7d..9ac0fcc0fa 100644
--- a/app/Presenters/SupplierPresenter.php
+++ b/app/Presenters/SupplierPresenter.php
@@ -240,7 +240,7 @@ class SupplierPresenter extends Presenter
public function formattedNameLink() {
- if (auth()->user()->can('supplier.view', $this)) {
+ if (auth()->user()->can('view', ['\App\Models\Supplier', $this])) {
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('suppliers.show', e($this->id)).'">'.e($this->name).'</a>';
}