Plugins: Expose core APIs only for certain plugins (#107967)
* feat(plugins): add a way to expose core apis only to certain plugins * review: update naming * review: update the owners of the feature toggle * feat: share the restricted apis with extensions * fix: linters * feat: remove the `addPanel` api * chore: fix linting and betterer issue * tests: use `@ts-expect-error` for more clarity
This commit is contained in:
@@ -214,6 +214,10 @@ type Cfg struct {
|
||||
|
||||
PluginUpdateStrategy string
|
||||
|
||||
// Plugin API restrictions - maps API name to list of plugin IDs/patterns
|
||||
PluginRestrictedAPIsAllowList map[string][]string
|
||||
PluginRestrictedAPIsBlockList map[string][]string
|
||||
|
||||
// Panels
|
||||
DisableSanitizeHtml bool
|
||||
|
||||
@@ -1057,6 +1061,10 @@ func NewCfg() *Cfg {
|
||||
Raw: ini.Empty(),
|
||||
Azure: &azsettings.AzureSettings{},
|
||||
|
||||
// Initialize plugin API restriction maps
|
||||
PluginRestrictedAPIsAllowList: make(map[string][]string),
|
||||
PluginRestrictedAPIsBlockList: make(map[string][]string),
|
||||
|
||||
// Avoid nil pointer
|
||||
IsFeatureToggleEnabled: func(_ string) bool {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user