feat(09-11): add permissioned admin metadata and settings

This commit is contained in:
Jakub Zych
2026-09-26 23:06:22 +02:00
parent 8b02fff028
commit 10ca7a02e3
12 changed files with 947 additions and 7 deletions

View File

@@ -75,7 +75,11 @@ type CompiledController struct {
// Registry is the immutable controller map keyed by controller ID.
type Registry struct {
byID map[string]*CompiledController
byID map[string]*CompiledController
permissions map[string]pact.Permission
roleGrants map[string]map[string]bool
navigation []pact.NavigationItem
settings map[string]*CompiledSetting
}
// Get returns the compiled controller for a D-09 id (vendor.plugin.controller).
@@ -87,6 +91,15 @@ func (r *Registry) Get(id string) (*CompiledController, bool) {
return cc, ok && cc != nil
}
// Setting returns one compiled singleton setting by stable code.
func (r *Registry) Setting(code string) (*CompiledSetting, bool) {
if r == nil {
return nil, false
}
setting, ok := r.settings[code]
return setting, ok && setting != nil
}
// Allows reports whether principal satisfies every required permission code.
// A nil principal fails. Superusers pass. An empty requirement list allows
// any authenticated principal. Grants ending in ".*" match by prefix.