Chore: Use OrgRoleMapper in Grafana.com client (#89013)
* Use OrgRoleMapper in Grafana.com client * Clean up
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/login"
|
||||
"github.com/grafana/grafana/pkg/services/oauthtoken"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
)
|
||||
@@ -166,17 +165,6 @@ func (c *OAuth) Authenticate(ctx context.Context, r *authn.Request) (*authn.Iden
|
||||
return nil, errOAuthEmailNotAllowed.Errorf("provided email is not allowed")
|
||||
}
|
||||
|
||||
// This is required to implement OrgRole mapping for OAuth providers step by step
|
||||
switch c.providerName {
|
||||
case social.GenericOAuthProviderName, social.GitHubProviderName, social.GitlabProviderName,
|
||||
social.OktaProviderName, social.GoogleProviderName, social.AzureADProviderName:
|
||||
// Do nothing, these providers already supports OrgRole mapping
|
||||
default:
|
||||
userInfo.OrgRoles, userInfo.IsGrafanaAdmin, _ = getRoles(c.cfg, func() (org.RoleType, *bool, error) {
|
||||
return userInfo.Role, userInfo.IsGrafanaAdmin, nil
|
||||
})
|
||||
}
|
||||
|
||||
lookupParams := login.UserLookupParams{}
|
||||
allowInsecureEmailLookup := c.settingsProviderSvc.KeyValue("auth", "oauth_allow_insecure_email_lookup").MustBool(false)
|
||||
if allowInsecureEmailLookup {
|
||||
|
||||
Reference in New Issue
Block a user