mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
SupportBundles: Access control guards (#61914)
* rename routes and fix access control for support bundles * AccessControl: Hide menu if not authorized * AccessControl: Add AC guards for create and delete * lint
This commit is contained in:
@@ -121,9 +121,6 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
}
|
||||
r.Get("/styleguide", reqSignedIn, hs.Index)
|
||||
|
||||
r.Get("/admin/support-bundles", reqGrafanaAdmin, hs.Index)
|
||||
r.Get("/admin/support-bundles/create", reqGrafanaAdmin, hs.Index)
|
||||
|
||||
r.Get("/live", reqGrafanaAdmin, hs.Index)
|
||||
r.Get("/live/pipeline", reqGrafanaAdmin, hs.Index)
|
||||
r.Get("/live/cloud", reqGrafanaAdmin, hs.Index)
|
||||
|
||||
@@ -185,6 +185,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
|
||||
"expressionsEnabled": hs.Cfg.ExpressionsEnabled,
|
||||
"awsAllowedAuthProviders": hs.Cfg.AWSAllowedAuthProviders,
|
||||
"awsAssumeRoleEnabled": hs.Cfg.AWSAssumeRoleEnabled,
|
||||
"supportBundlesEnabled": isSupportBundlesEnabled(hs),
|
||||
"azure": map[string]interface{}{
|
||||
"cloud": hs.Cfg.Azure.Cloud,
|
||||
"managedIdentityEnabled": hs.Cfg.Azure.ManagedIdentityEnabled,
|
||||
@@ -222,6 +223,11 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
|
||||
return jsonObj, nil
|
||||
}
|
||||
|
||||
func isSupportBundlesEnabled(hs *HTTPServer) bool {
|
||||
return hs.Cfg.SectionWithEnvOverrides("support_bundles").Key("enabled").MustBool(false) &&
|
||||
hs.Features.IsEnabled(featuremgmt.FlagSupportBundles)
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) getFSDataSources(c *models.ReqContext, enabledPlugins EnabledPlugins) (map[string]plugins.DataSourceDTO, error) {
|
||||
orgDataSources := make([]*datasources.DataSource, 0)
|
||||
if c.OrgID != 0 {
|
||||
|
||||
Reference in New Issue
Block a user