feat(36-01): add TokenScope.Group and AdminAPITokenScope plugin_id/group metadata
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user