Merge remote-tracking branch 'origin/v3' into v3-master

This commit is contained in:
snipe 2016-06-10 03:41:03 -07:00
commit 02a9394cd9
3 changed files with 4 additions and 7 deletions

View file

@ -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();

View file

@ -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'));

View file

@ -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()