diff --git a/.gitignore b/.gitignore index 66dbe40f110..9762833b380 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,8 @@ profile.cov /pkg/cmd/grafana-server/grafana-server /pkg/cmd/grafana-server/debug /pkg/extensions/* +/pkg/build/cmd/artifactspage.go +/pkg/build/cmd/artifactspage.tmpl.html /pkg/server/wireexts_enterprise.go /pkg/cmd/grafana-cli/runner/wireexts_enterprise.go !/pkg/extensions/main.go diff --git a/pkg/api/api.go b/pkg/api/api.go index 15092de31bf..2d07d864d9d 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -193,7 +193,7 @@ func (hs *HTTPServer) registerRoutes() { // sign up r.Get("/verify", hs.Index) r.Get("/signup", hs.Index) - r.Get("/api/user/signup/options", routing.Wrap(GetSignUpOptions)) + r.Get("/api/user/signup/options", routing.Wrap(hs.GetSignUpOptions)) r.Post("/api/user/signup", quota(user.QuotaTargetSrv), quota(org.QuotaTargetSrv), routing.Wrap(hs.SignUp)) r.Post("/api/user/signup/step2", routing.Wrap(hs.SignUpStep2)) diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index 40c5de4fb68..789613047c8 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -113,7 +113,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro AlertingNoDataOrNullValues: setting.AlertingNoDataOrNullValues, AlertingMinInterval: setting.AlertingMinInterval, LiveEnabled: hs.Cfg.LiveMaxConnections != 0, - AutoAssignOrg: setting.AutoAssignOrg, + AutoAssignOrg: hs.Cfg.AutoAssignOrg, VerifyEmailEnabled: setting.VerifyEmailEnabled, SigV4AuthEnabled: setting.SigV4AuthEnabled, AzureAuthEnabled: setting.AzureAuthEnabled, diff --git a/pkg/api/signup.go b/pkg/api/signup.go index b14f74b4920..49600a0dc94 100644 --- a/pkg/api/signup.go +++ b/pkg/api/signup.go @@ -19,10 +19,10 @@ import ( ) // GET /api/user/signup/options -func GetSignUpOptions(c *contextmodel.ReqContext) response.Response { +func (hs *HTTPServer) GetSignUpOptions(c *contextmodel.ReqContext) response.Response { return response.JSON(http.StatusOK, util.DynMap{ "verifyEmailEnabled": setting.VerifyEmailEnabled, - "autoAssignOrg": setting.AutoAssignOrg, + "autoAssignOrg": hs.Cfg.AutoAssignOrg, }) } diff --git a/pkg/services/contexthandler/authproxy/authproxy.go b/pkg/services/contexthandler/authproxy/authproxy.go index 8d151b5b093..847ae84c0b9 100644 --- a/pkg/services/contexthandler/authproxy/authproxy.go +++ b/pkg/services/contexthandler/authproxy/authproxy.go @@ -282,8 +282,8 @@ func (auth *AuthProxy) loginViaHeader(reqCtx *contextmodel.ReqContext) (int64, e if rt.IsValid() { extUser.OrgRoles = map[int64]org.RoleType{} orgID := int64(1) - if setting.AutoAssignOrg && setting.AutoAssignOrgId > 0 { - orgID = int64(setting.AutoAssignOrgId) + if auth.cfg.AutoAssignOrg && auth.cfg.AutoAssignOrgId > 0 { + orgID = int64(auth.cfg.AutoAssignOrgId) } extUser.OrgRoles[orgID] = rt } diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 968a3edaa32..86ae820e7d2 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -22,11 +22,12 @@ import ( "time" "github.com/gobwas/glob" + "github.com/prometheus/common/model" + "gopkg.in/ini.v1" + "github.com/grafana/grafana-aws-sdk/pkg/awsds" "github.com/grafana/grafana-azure-sdk-go/azsettings" "github.com/grafana/grafana-plugin-sdk-go/backend/gtime" - "github.com/prometheus/common/model" - "gopkg.in/ini.v1" "github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/util" @@ -93,9 +94,6 @@ var ( // User settings AllowUserSignUp bool AllowUserOrgCreate bool - AutoAssignOrg bool - AutoAssignOrgId int - AutoAssignOrgRole string VerifyEmailEnabled bool LoginHint string PasswordHint string @@ -1559,11 +1557,8 @@ func readUserSettings(iniFile *ini.File, cfg *Cfg) error { AllowUserSignUp = users.Key("allow_sign_up").MustBool(true) AllowUserOrgCreate = users.Key("allow_org_create").MustBool(true) cfg.AutoAssignOrg = users.Key("auto_assign_org").MustBool(true) - AutoAssignOrg = cfg.AutoAssignOrg cfg.AutoAssignOrgId = users.Key("auto_assign_org_id").MustInt(1) - AutoAssignOrgId = cfg.AutoAssignOrgId cfg.AutoAssignOrgRole = users.Key("auto_assign_org_role").In("Editor", []string{"Editor", "Admin", "Viewer"}) - AutoAssignOrgRole = cfg.AutoAssignOrgRole VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false) cfg.CaseInsensitiveLogin = users.Key("case_insensitive_login").MustBool(false)