mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Make locations deletable for non Superuser-Accounts with FullMultipleCompanySupport
locations->isDeletable() checks via gate::allows if a locations is deletable. This calls SnipePermissionsPolicy->before() and checks for !Company::isCurrentUserHasAccess($item). This returns false because locations don't have a company_id. Check for this and return true if the item don't have a company_id.
This commit is contained in:
parent
593e1234a5
commit
1a908e361e
|
@ -125,6 +125,11 @@ final class Company extends SnipeModel
|
|||
return false;
|
||||
} elseif (!static::isFullMultipleCompanySupportEnabled()) {
|
||||
return true;
|
||||
} elseif (!$companyable instanceof Company && !\Schema::hasColumn($companyable->getModel()->getTable(), 'company_id')) {
|
||||
// This is primary for the gate:allows-check in location->isDeletable()
|
||||
// Locations don't have a company_id so without this it isn't possible to delete locations with FullMultipleCompanySupport enabled
|
||||
// because this function is called by SnipePermissionsPolicy->before()
|
||||
return true;
|
||||
} else {
|
||||
if (Auth::user()) {
|
||||
$current_user_company_id = Auth::user()->company_id;
|
||||
|
|
Loading…
Reference in a new issue