feat(36-01): add TokenScope.Group and AdminAPITokenScope plugin_id/group metadata

This commit is contained in:
Jakub Zych
2026-11-24 19:28:59 +01:00
parent 7644786d62
commit cb259ba910
4 changed files with 92 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ type compiledTokenScope struct {
Name string
Label string
Description string
Group string
Permissions []string
Methods map[string]bool
Full bool // framework scopes * and admin:read
@@ -90,6 +91,7 @@ func compileTokenScopes(reg *Registry, plugins []party.Plugin) error {
Name: scope.Name,
Label: scope.Label,
Description: scope.Description,
Group: strings.TrimSpace(scope.Group),
Permissions: perms,
Methods: methods,
PluginID: plugin.ID(),
@@ -166,7 +168,7 @@ func validateTokenScopeMessageKeys(reg *Registry, tr *phrasebook.Translator) err
if who == "" {
who = "framework"
}
for _, text := range []string{scope.Label, scope.Description} {
for _, text := range []string{scope.Label, scope.Description, scope.Group} {
if strings.Contains(text, "::") && !tr.Has(text) {
return fmt.Errorf("cabana: token scope %s (%s) names missing phrase key %s", scope.Name, who, text)
}