mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-25 12:41:16 -08:00
Only try to get the company if there is an auth’d user
(Needed for command line tools, where no Auth::user() is present)
This commit is contained in:
parent
ec6ed256fb
commit
45afe725a1
|
@ -128,9 +128,12 @@ final class Company extends SnipeModel
|
||||||
} elseif (!static::isFullMultipleCompanySupportEnabled()) {
|
} elseif (!static::isFullMultipleCompanySupportEnabled()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$current_user_company_id = Auth::user()->company_id;
|
if (Auth::user()) {
|
||||||
$companyable_company_id = $companyable->company_id;
|
$current_user_company_id = Auth::user()->company_id;
|
||||||
return ($current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser());
|
$companyable_company_id = $companyable->company_id;
|
||||||
|
return ($current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue