feat(quick-261016-0fm): admin language follows the stored preference
- principalFrom sets PreferredLocale from metadata admin_locale; personal API token principals clear it, so token clients keep the request locale - the guarded admin group runs locale.from-principal after the backend guard, overriding the LocaleResolver or Accept-Language locale - GET /lang honours a supported ?locale= and reports meta.locales (cabana.LangEnvelope, cabana.LangMeta) - Docker test for the override, refusals and /lang; docs and OpenAPI
This commit is contained in:
@@ -106,6 +106,9 @@ func principalFrom(user BackendUser) *bouncer.Principal {
|
||||
Backend: true,
|
||||
IsSuperuser: user.IsSuperuser,
|
||||
PermissionGrants: parseGrants(user.Role.Permissions),
|
||||
// The admin's chosen admin language (validated on write); empty
|
||||
// keeps the request locale. Personal API tokens clear it.
|
||||
PreferredLocale: metadataString(user.Metadata, metadataAdminLocale),
|
||||
}
|
||||
if user.TokensValidAfter != nil {
|
||||
principal.TokensValidAfter = *user.TokensValidAfter
|
||||
|
||||
Reference in New Issue
Block a user