feat(09-11): add permissioned admin metadata and settings
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user