A free open source IT asset/license management system
Let superadmins through companyable trait
snipea0901247a349
diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.phpindex 0425cb86f6..3e2f8a832f 100755--- a/app/Http/Controllers/AssetsController.php+++ b/app/Http/Controllers/AssetsController.php@@ -255,8 +255,9 @@ class AssetsController extends Controller*/public function getEdit($assetId = null){+// Check if the asset exists- if (is_null($asset = Asset::find($assetId))) {+ if (!$asset = Asset::find($assetId)) {// Redirect to the asset management pagereturn redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));} elseif (!Company::isCurrentUserHasAccess($asset)) {diff --git a/app/Models/Company.php b/app/Models/Company.phpindex 5d563f0681..740008d3c1 100644--- a/app/Models/Company.php+++ b/app/Models/Company.php@@ -102,14 +102,14 @@ final class Company extends Model} else {$current_user_company_id = Auth::user()->company_id;$companyable_company_id = $companyable->company_id;-- return ($current_user_company_id == null || $current_user_company_id == $companyable_company_id);+ return ($current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser());}}public static function isCurrentUserAuthorized(){- return (!static::isFullMultipleCompanySupportEnabled() || (Auth::user()->company_id == null) || Auth::user()->isSuperUser());++ return ((!static::isFullMultipleCompanySupportEnabled()) || (Auth::user()->company_id == null) || (Auth::user()->isSuperUser()));}public static function canManageUsersCompanies()