Plugins: Add secure JSON fields to plugin setting DTO (#55313)
* add secure JSON fields to plugin setting DTO * add nil pointer fix * adding secureJsonFields to the plugin meta. Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
co-authored by
Marcus Andersson
parent
c10a69c007
commit
b25ea75bac
+14
-11
@@ -431,8 +431,8 @@ func (hs *HTTPServer) enabledPlugins(ctx context.Context, orgID int64) (EnabledP
|
||||
return ep, nil
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) pluginSettings(ctx context.Context, orgID int64) (map[string]*pluginsettings.DTO, error) {
|
||||
pluginSettings := make(map[string]*pluginsettings.DTO)
|
||||
func (hs *HTTPServer) pluginSettings(ctx context.Context, orgID int64) (map[string]*pluginsettings.InfoDTO, error) {
|
||||
pluginSettings := make(map[string]*pluginsettings.InfoDTO)
|
||||
|
||||
// fill settings from database
|
||||
if pss, err := hs.PluginSettings.GetPluginSettings(ctx, &pluginsettings.GetArgs{OrgID: orgID}); err != nil {
|
||||
@@ -451,11 +451,12 @@ func (hs *HTTPServer) pluginSettings(ctx context.Context, orgID int64) (map[stri
|
||||
}
|
||||
|
||||
// add new setting which is enabled depending on if AutoEnabled: true
|
||||
pluginSetting := &pluginsettings.DTO{
|
||||
PluginID: plugin.ID,
|
||||
OrgID: orgID,
|
||||
Enabled: plugin.AutoEnabled,
|
||||
Pinned: plugin.AutoEnabled,
|
||||
pluginSetting := &pluginsettings.InfoDTO{
|
||||
PluginID: plugin.ID,
|
||||
OrgID: orgID,
|
||||
Enabled: plugin.AutoEnabled,
|
||||
Pinned: plugin.AutoEnabled,
|
||||
PluginVersion: plugin.Info.Version,
|
||||
}
|
||||
|
||||
pluginSettings[plugin.ID] = pluginSetting
|
||||
@@ -469,10 +470,12 @@ func (hs *HTTPServer) pluginSettings(ctx context.Context, orgID int64) (map[stri
|
||||
}
|
||||
|
||||
// add new setting which is enabled by default
|
||||
pluginSetting := &pluginsettings.DTO{
|
||||
PluginID: plugin.ID,
|
||||
OrgID: orgID,
|
||||
Enabled: true,
|
||||
pluginSetting := &pluginsettings.InfoDTO{
|
||||
PluginID: plugin.ID,
|
||||
OrgID: orgID,
|
||||
Enabled: true,
|
||||
Pinned: false,
|
||||
PluginVersion: plugin.Info.Version,
|
||||
}
|
||||
|
||||
// if plugin is included in an app, check app settings
|
||||
|
||||
Reference in New Issue
Block a user