mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Auth: Set the default org after User login (#83918)
* poc * add logger, skip hook when user is not assigned to default org * Add tests, move to hook folder * docs * Skip for OrgId < 1 * Address feedback * Update docs/sources/setup-grafana/configure-grafana/_index.md * lint * Move the hook to org_sync.go * Update pkg/services/authn/authnimpl/sync/org_sync.go * Handle the case when GetUserOrgList returns error --------- Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
@@ -411,6 +411,7 @@ type Cfg struct {
|
||||
AutoAssignOrg bool
|
||||
AutoAssignOrgId int
|
||||
AutoAssignOrgRole string
|
||||
LoginDefaultOrgId int64
|
||||
OAuthSkipOrgRoleUpdateSync bool
|
||||
|
||||
// ExpressionsEnabled specifies whether expressions are enabled.
|
||||
@@ -1658,6 +1659,7 @@ func readUserSettings(iniFile *ini.File, cfg *Cfg) error {
|
||||
cfg.AllowUserOrgCreate = users.Key("allow_org_create").MustBool(true)
|
||||
cfg.AutoAssignOrg = users.Key("auto_assign_org").MustBool(true)
|
||||
cfg.AutoAssignOrgId = users.Key("auto_assign_org_id").MustInt(1)
|
||||
cfg.LoginDefaultOrgId = users.Key("login_default_org_id").MustInt64(-1)
|
||||
cfg.AutoAssignOrgRole = users.Key("auto_assign_org_role").In(
|
||||
string(roletype.RoleViewer), []string{
|
||||
string(roletype.RoleNone),
|
||||
|
||||
Reference in New Issue
Block a user