diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 2df8648371..0425cb86f6 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -695,9 +695,7 @@ class AssetsController extends Controller $asset = Asset::find($assetId); $size = Helper::barcodeDimensions($settings->barcode_type); - if (!Company::isCurrentUserHasAccess($asset)) { - return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions')); - } + if (isset($asset->id,$asset->asset_tag)) { $barcode = new \Com\Tecnick\Barcode\Barcode(); @@ -724,9 +722,6 @@ class AssetsController extends Controller $settings = Setting::getSettings(); $asset = Asset::find($assetId); - if (!Company::isCurrentUserHasAccess($asset)) { - return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions')); - } if (isset($asset->id,$asset->asset_tag)) { $barcode = new \Com\Tecnick\Barcode\Barcode(); diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 4b7642a88d..4627ccb303 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -338,6 +338,7 @@ class SettingsController extends Controller $setting->locale = e(Input::get('locale', 'en')); $setting->qr_code = e(Input::get('qr_code', '0')); + $setting->full_multiple_companies_support = e(Input::get('full_multiple_companies_support', '0')); $setting->alt_barcode = e(Input::get('alt_barcode')); $setting->alt_barcode_enabled = e(Input::get('alt_barcode_enabled', '0')); $setting->barcode_type = e(Input::get('barcode_type')); diff --git a/app/Models/Company.php b/app/Models/Company.php index ce4ef4bf45..5d563f0681 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use Watson\Validating\ValidatingTrait; +use Auth; /** * Model for Companies. @@ -108,7 +109,7 @@ final class Company extends Model public static function isCurrentUserAuthorized() { - return (!static::isFullMultipleCompanySupportEnabled() || Auth::user()->company_id == null); + return (!static::isFullMultipleCompanySupportEnabled() || (Auth::user()->company_id == null) || Auth::user()->isSuperUser()); } public static function canManageUsersCompanies()