Skip to content

[6.x] Resolve dictionary fieldtype permissions via the CP guard - #15209

Merged
jasonvarga merged 2 commits into
6.xfrom
dictionary-cp-guard
Aug 18, 2026
Merged

[6.x] Resolve dictionary fieldtype permissions via the CP guard#15209
jasonvarga merged 2 commits into
6.xfrom
dictionary-cp-guard

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Aug 18, 2026

Copy link
Copy Markdown
Member

This pull request fixes an issue where the dictionary fieldtype endpoint resolved the access cp permission using the default auth guard, rather than the guard configured for the Control Panel.

When the default guard differed from the CP guard, dictionary dropdowns in the Control Panel would silently render empty, since the endpoint would return a 403 even for authenticated CP users. Worse, when a non-Statamic user was authenticated on the default guard, the endpoint would return a 500 (Call to a member function isSuper() on null), because the Gate::after callback in the AuthServiceProvider didn't account for User::fromUser() returning null.

This PR fixes it by adding the CP AuthGuard middleware to the dictionary fieldtype route, so the permission check is resolved against the CP guard. Only the guard middleware is applied, not the full CP middleware group, so dictionaries which allow public access remain accessible to guests. This PR also returns null from the Gate::after callback when the authenticated user isn't a Statamic user, so the gate abstains rather than erroring.

Fixes #15204

duncanmcclean and others added 2 commits August 18, 2026 09:21
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit 3cbca4d into 6.x Aug 18, 2026
66 checks passed
@jasonvarga
jasonvarga deleted the dictionary-cp-guard branch August 18, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dictionary fieldtype endpoint resolves permissions via the default guard, crashing when a non-Statamic user is authenticated

2 participants