AuthN: Lock down manual role updates for users synced through Grafana Com portal (#72044)

take into account auth.grafananet config section when checking if gcom auth is enabled
This commit is contained in:
Ieva
2023-07-21 15:22:28 +01:00
committed by GitHub
parent 12f7524c86
commit 59eb2f68b7
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -494,6 +494,9 @@ type Cfg struct {
// skip the org roles coming from GrafanaCom
GrafanaComSkipOrgRoleSync bool
// Grafana.com Auth enabled through [auth.grafananet] config section
GrafanaNetAuthEnabled bool
// Geomap base layer config
GeomapDefaultBaseLayerConfig map[string]interface{}
GeomapEnableCustomBaseLayers bool
@@ -1452,6 +1455,11 @@ func readAuthGrafanaComSettings(cfg *Cfg) {
cfg.GrafanaComSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
}
func readAuthGrafanaNetSettings(cfg *Cfg) {
sec := cfg.SectionWithEnvOverrides("auth.grafananet")
cfg.GrafanaNetAuthEnabled = sec.Key("enabled").MustBool(false)
}
func readAuthGithubSettings(cfg *Cfg) {
sec := cfg.SectionWithEnvOverrides("auth.github")
cfg.GitHubAuthEnabled = sec.Key("enabled").MustBool(false)
@@ -1559,6 +1567,7 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
// GrafanaCom
readAuthGrafanaComSettings(cfg)
readAuthGrafanaNetSettings(cfg)
// Github
readAuthGithubSettings(cfg)