A free open source IT asset/license management system
One more fix for #19112
snipe42df2f6c3146
diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.phpindex 481de7bb5f..3a76186d1d 100644--- a/app/Http/Controllers/Api/LocationsController.php+++ b/app/Http/Controllers/Api/LocationsController.php@@ -444,13 +444,16 @@ class LocationsController extends Controller'locations.tag_color',]);- // Only scope locations if the setting is enabled+ // scope_locations_fmcs is an explicit opt-in to restrict locations by company.+ // Without it, locations are visible to all users regardless of FMCS state.if (Setting::getSettings()->scope_locations_fmcs) {$locations = Company::scopeCompanyables($locations);- }- if ((Setting::getSettings()->full_multiple_companies_support == '1') && $request->filled('companyId')) {- $locations->where('locations.company_id', $request->input('companyId'));+ // Allow further narrowing to a specific company (e.g. passed via data-company-id+ // from a checkout form). Superusers are exempt so they can always see all locations.+ if ($request->filled('companyId') && ! auth()->user()->isSuperUser()) {+ $locations->where('locations.company_id', $request->input('companyId'));+ }}$page = 1;diff --git a/app/Models/Company.php b/app/Models/Company.phpindex c6c741db8e..66e13a50cc 100644--- a/app/Models/Company.php+++ b/app/Models/Company.php@@ -269,7 +269,7 @@ final class Company extends SnipeModel{return ! self::isFullMultipleCompanySupportEnabled()|| auth()->user()->isSuperUser()- || empty(self::getCurrentUserCompanyIds());+ || ! empty(self::getCurrentUserCompanyIds());}/**