FeatureFlags: define features outside settings.Cfg (take 3) (#44443)

This commit is contained in:
Ryan McKinley
2022-01-26 09:44:20 -08:00
committed by GitHub
parent 84a5910e56
commit 5d66194ec5
64 changed files with 1193 additions and 248 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
@@ -89,7 +90,7 @@ func (hs *HTTPServer) CreateOrg(c *models.ReqContext) response.Response {
if err := web.Bind(c.Req, &cmd); err != nil {
return response.Error(http.StatusBadRequest, "bad request data", err)
}
acEnabled := hs.Cfg.FeatureToggles["accesscontrol"]
acEnabled := hs.Features.IsEnabled(featuremgmt.FlagAccesscontrol)
if !acEnabled && !(setting.AllowUserOrgCreate || c.IsGrafanaAdmin) {
return response.Error(403, "Access denied", nil)
}