Skip to content

[6.x] Fix permission labels not being localized correctly#12316

Merged
jasonvarga merged 2 commits intomasterfrom
localize-before-we-authorize
Sep 16, 2025
Merged

[6.x] Fix permission labels not being localized correctly#12316
jasonvarga merged 2 commits intomasterfrom
localize-before-we-authorize

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

This pull request fixes an issue where permission labels weren't being localized correctly, due to permissions being booted before the user's locale was set.

The Authorize middleware ended up calling Permissions::boot(), which now has a if ($this->booted) conditional, preventing it from being called multiple times.

Related: #11516
Fixes #12312

@duncanmcclean duncanmcclean linked an issue Sep 5, 2025 that may be closed by this pull request
@duncanmcclean
Copy link
Copy Markdown
Member Author

duncanmcclean commented Sep 5, 2025

Not entirely sure how me swapping the order of two middleware cause GraphQL and Arr tests to fail... but okay 😅

@jasonvarga
Copy link
Copy Markdown
Member

What the

@jasonvarga
Copy link
Copy Markdown
Member

I think what happened was...

  • Localize middleware would set the carbon format, which is static
  • Authorize middleware runs in some test, and triggers a 403
  • Localize middleware doesn't get a chance reset the carbon format
  • A later test gets the incorrect carbon format

This wasn't happening before because the 403 would happen before the carbon format would even attempt to get set.

@jasonvarga jasonvarga merged commit f1e6bfa into master Sep 16, 2025
18 checks passed
@jasonvarga jasonvarga deleted the localize-before-we-authorize branch September 16, 2025 17:40
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.

[6.x] Most of the roles permissions do not translate anymore

2 participants