Fix access control service init (#32492)

* Fix access control service init

* Chore: use assert from testify package
This commit is contained in:
Alexander Zobnin 2021-03-30 16:14:43 +03:00 committed by GitHub
parent 270a255c08
commit 784425c2ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import (
"github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/middleware"
_ "github.com/grafana/grafana/pkg/plugins/manager" _ "github.com/grafana/grafana/pkg/plugins/manager"
"github.com/grafana/grafana/pkg/registry" "github.com/grafana/grafana/pkg/registry"
_ "github.com/grafana/grafana/pkg/services/accesscontrol/manager"
_ "github.com/grafana/grafana/pkg/services/alerting" _ "github.com/grafana/grafana/pkg/services/alerting"
_ "github.com/grafana/grafana/pkg/services/auth" _ "github.com/grafana/grafana/pkg/services/auth"
_ "github.com/grafana/grafana/pkg/services/cleanup" _ "github.com/grafana/grafana/pkg/services/cleanup"

View File

@ -40,6 +40,10 @@ func (m *Manager) Init() error {
} }
func (m *Manager) IsDisabled() bool { func (m *Manager) IsDisabled() bool {
if m.Cfg == nil {
return true
}
_, exists := m.Cfg.FeatureToggles["accesscontrol"] _, exists := m.Cfg.FeatureToggles["accesscontrol"]
return !exists return !exists
} }