fix(next): ensures req.locale is populated before running access control (#10533)

Fixes #10529. The `req.locale` property within collection and global
access control functions does not reflect the current locale. This was
because we were attaching the locale to the req only _after_ running
`payload.auth`, which attempts to get access control without a
fully-formed req. The fix is to first authenticate the user using the
`executeAuthStrategies` operation directly, then determine the request
locale with that user, and finally get access results with the proper
locale.
This commit is contained in:
Jacob Fletcher
2025-01-13 10:33:27 -05:00
committed by GitHub
parent 6b051bd59e
commit afcc970e36
7 changed files with 90 additions and 35 deletions

View File

@@ -18,3 +18,4 @@ export const withRequiredLocalizedFields = 'localized-required'
export const localizedSortSlug = 'localized-sort'
export const usersSlug = 'users'
export const blocksWithLocalizedSameName = 'blocks-same-name'
export const cannotCreateDefaultLocale = 'cannot-create-default-locale'