mirror of
https://github.com/grafana/grafana.git
synced 2026-08-11 13:44:59 -05:00
Auth: Fix orgrole picker disabled if isSynced user (#64033)
* fix: disable orgrolepicker if externaluser is synced * add disable to role picker * just took me 2 hours to center the icon * wip * fix: check externallySyncedUser for API call * remove check from store * add: tests * refactor authproxy and made tests run * add: feature toggle * set feature toggle for tests * add: IsProviderEnabled * refactor: featuretoggle name * IsProviderEnabled tests * add specific tests for isProviderEnabled * fix: org_user tests * add: owner to featuretoggle * add missing authlabels * remove fmt * feature toggle * change config * add test for a different authmodule * test refactor * gen feature toggle again * fix basic auth user able to change the org role * test for basic auth role * make err.base to error * lowered lvl of log and input mesg
This commit is contained in:
+22
-5
@@ -405,19 +405,23 @@ type Cfg struct {
|
||||
IntercomSecret string
|
||||
|
||||
// AzureAD
|
||||
AzureADEnabled bool
|
||||
AzureADSkipOrgRoleSync bool
|
||||
|
||||
// Google
|
||||
GoogleAuthEnabled bool
|
||||
GoogleSkipOrgRoleSync bool
|
||||
|
||||
// Gitlab
|
||||
GitLabAuthEnabled bool
|
||||
GitLabSkipOrgRoleSync bool
|
||||
|
||||
// Generic OAuth
|
||||
GenericOAuthAuthEnabled bool
|
||||
GenericOAuthSkipOrgRoleSync bool
|
||||
|
||||
// LDAP
|
||||
LDAPEnabled bool
|
||||
LDAPAuthEnabled bool
|
||||
LDAPSkipOrgRoleSync bool
|
||||
LDAPConfigFilePath string
|
||||
LDAPAllowSignup bool
|
||||
@@ -453,8 +457,9 @@ type Cfg struct {
|
||||
// then Live uses AppURL as the only allowed origin.
|
||||
LiveAllowedOrigins []string
|
||||
|
||||
// Github OAuth
|
||||
GithubSkipOrgRoleSync bool
|
||||
// GitHub OAuth
|
||||
GitHubAuthEnabled bool
|
||||
GitHubSkipOrgRoleSync bool
|
||||
|
||||
// Grafana.com URL, used for OAuth redirect.
|
||||
GrafanaComURL string
|
||||
@@ -462,6 +467,8 @@ type Cfg struct {
|
||||
// in case API is not publicly accessible.
|
||||
// Defaults to GrafanaComURL setting + "/api" if unset.
|
||||
GrafanaComAPIURL string
|
||||
// Grafana.com Auth enabled
|
||||
GrafanaComAuthEnabled bool
|
||||
// GrafanaComSkipOrgRoleSync can be set for
|
||||
// letting users set org roles from within Grafana and
|
||||
// skip the org roles coming from GrafanaCom
|
||||
@@ -486,9 +493,11 @@ type Cfg struct {
|
||||
SecureSocksDSProxy SecureSocksDSProxySettings
|
||||
|
||||
// SAML Auth
|
||||
SAMLAuthEnabled bool
|
||||
SAMLSkipOrgRoleSync bool
|
||||
|
||||
// Okta OAuth
|
||||
OktaAuthEnabled bool
|
||||
OktaSkipOrgRoleSync bool
|
||||
|
||||
// Access Control
|
||||
@@ -1190,6 +1199,7 @@ type RemoteCacheOptions struct {
|
||||
|
||||
func (cfg *Cfg) readSAMLConfig() {
|
||||
samlSec := cfg.Raw.Section("auth.saml")
|
||||
cfg.SAMLAuthEnabled = samlSec.Key("enabled").MustBool(false)
|
||||
cfg.SAMLSkipOrgRoleSync = samlSec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
@@ -1197,7 +1207,7 @@ func (cfg *Cfg) readLDAPConfig() {
|
||||
ldapSec := cfg.Raw.Section("auth.ldap")
|
||||
cfg.LDAPConfigFilePath = ldapSec.Key("config_file").String()
|
||||
cfg.LDAPSyncCron = ldapSec.Key("sync_cron").String()
|
||||
cfg.LDAPEnabled = ldapSec.Key("enabled").MustBool(false)
|
||||
cfg.LDAPAuthEnabled = ldapSec.Key("enabled").MustBool(false)
|
||||
cfg.LDAPSkipOrgRoleSync = ldapSec.Key("skip_org_role_sync").MustBool(false)
|
||||
cfg.LDAPActiveSyncEnabled = ldapSec.Key("active_sync_enabled").MustBool(false)
|
||||
cfg.LDAPAllowSignup = ldapSec.Key("allow_sign_up").MustBool(true)
|
||||
@@ -1376,36 +1386,43 @@ func readSecuritySettings(iniFile *ini.File, cfg *Cfg) error {
|
||||
}
|
||||
func readAuthAzureADSettings(iniFile *ini.File, cfg *Cfg) {
|
||||
sec := iniFile.Section("auth.azuread")
|
||||
cfg.AzureADEnabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.AzureADSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
func readAuthGrafanaComSettings(iniFile *ini.File, cfg *Cfg) {
|
||||
sec := iniFile.Section("auth.grafana_com")
|
||||
cfg.GrafanaComAuthEnabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.GrafanaComSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
func readAuthGithubSettings(iniFile *ini.File, cfg *Cfg) {
|
||||
sec := iniFile.Section("auth.github")
|
||||
cfg.GithubSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
cfg.GitHubAuthEnabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.GitHubSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
func readAuthGoogleSettings(iniFile *ini.File, cfg *Cfg) {
|
||||
sec := iniFile.Section("auth.google")
|
||||
cfg.GoogleAuthEnabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.GoogleSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
func readAuthGitlabSettings(iniFile *ini.File, cfg *Cfg) {
|
||||
sec := iniFile.Section("auth.gitlab")
|
||||
cfg.GitLabAuthEnabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.GitLabSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
func readGenericOAuthSettings(iniFile *ini.File, cfg *Cfg) {
|
||||
sec := iniFile.Section("auth.generic_oauth")
|
||||
cfg.GenericOAuthAuthEnabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.GenericOAuthSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
func readAuthOktaSettings(iniFile *ini.File, cfg *Cfg) {
|
||||
sec := iniFile.Section("auth.okta")
|
||||
cfg.OktaAuthEnabled = sec.Key("enabled").MustBool(false)
|
||||
cfg.OktaSkipOrgRoleSync = sec.Key("skip_org_role_sync").MustBool(false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user