mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Let superadmins through companyable trait
This commit is contained in:
parent
02a9394cd9
commit
a0901247a3
|
@ -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 page
|
||||
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($asset)) {
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue