Bug description
Entry create/edit screens build their localizations list through EntriesController::getAuthorizedSitesForCollection(), which filters collection sites to only sites the current user can view.
protectedfunctiongetAuthorizedSitesForCollection($collection)
{
return$collection
->sites()
->filter(fn ($handle) => User::current()->can('view', Site::get($handle)));
}The entry revision preview endpoint does not use that same filtering. EntryRevisionsController builds localizations directly from every collection site:
'localizations' => $entry->collection()->sites()->map(function ($handle) use ($entry) {Proposed fix:
- 'localizations' => $entry->collection()->sites()->map(function ($handle) use ($entry) {+ 'localizations' => $this->getAuthorizedSitesForCollection($entry->collection())->map(function ($handle) use ($entry) {+ protected function getAuthorizedSitesForCollection($collection)+ {+ return $collection+ ->sites()+ ->filter(fn ($handle) => User::current()->can('view', Site::get($handle)));+ }How to reproduce
- Enable multisite.
- Create a collection available on multiple sites.
- Create a user who can view the collection/entry but cannot view every site in the collection.
- Enable revisions for the collection.
- View an entry revision in the Control Panel.
- Inspect the revision preview response.
The localizations array includes all collection sites instead of only sites the user can view.
Logs
Environment
EnvironmentLaravel Version: 13.9.0PHP Version: 8.5.5Composer Version: 2.9.5Environment: localDebug Mode: ENABLEDMaintenance Mode: OFFTimezone: UTCLocale: enCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: CACHEDDriversBroadcasting: logCache: fileDatabase: mariadbLogs: stack / dailyMail: logQueue: databaseSession: fileStoragepublic/storage: NOT LINKEDStatamicAddons: 4License Key: SetSites: 1522 (Aardvark, Abbott Group, Abbott, Reichel and Schulist, and 1519 more)Stache Watcher: Enabled (auto)Static Caching: DisabledVersion: 6.19.0 PROStatamic Addonsndx/statamic-simple-redirects: 1.1.0statamic/audit-log: 1.1.0statamic/collaboration: 2.0.1statamic/eloquent-driver: 5.8.0Statamic Eloquent DriverAddon Settings: fileAsset Containers: eloquentAssets: eloquentBlueprints: eloquentCollection Trees: eloquentCollections: fileEntries: eloquentFieldsets: fileForm Submissions: eloquentForms: eloquentGlobal Sets: eloquentGlobal Variables: eloquentNavigation Trees: eloquentNavigations: eloquentRevisions: eloquentSites: eloquentTaxonomies: eloquentTerms: eloquentTokens: eloquent
Installation
Existing Laravel app
Additional details
No response
Bug description
Entry create/edit screens build their
localizationslist throughEntriesController::getAuthorizedSitesForCollection(), which filters collection sites to only sites the current user can view.The entry revision preview endpoint does not use that same filtering.
EntryRevisionsControllerbuildslocalizationsdirectly from every collection site:Proposed fix:
How to reproduce
The
localizationsarray includes all collection sites instead of only sites the user can view.Logs
Environment
Installation
Existing Laravel app
Additional details
No response