AccessControl: Enable RBAC by default (#48813)

* Add RBAC section to settings

* Default to RBAC enabled settings to true

* Update tests to respect RBAC

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
Ieva
2022-05-16 12:45:41 +02:00
committed by GitHub
co-authored by Karl Persson
parent 3106af9eec
commit f256f625d8
40 changed files with 540 additions and 282 deletions
+9
View File
@@ -443,6 +443,9 @@ type Cfg struct {
QueryHistoryEnabled bool
DashboardPreviews DashboardPreviewsSettings
// Access Control
RBACEnabled bool
}
type CommandLineArgs struct {
@@ -925,6 +928,7 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
if err := readAuthSettings(iniFile, cfg); err != nil {
return err
}
readAccessControlSettings(iniFile, cfg)
if err := cfg.readRenderingSettings(iniFile); err != nil {
return err
}
@@ -1351,6 +1355,11 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
return nil
}
func readAccessControlSettings(iniFile *ini.File, cfg *Cfg) {
rbac := iniFile.Section("rbac")
cfg.RBACEnabled = rbac.Key("enabled").MustBool(true)
}
func readUserSettings(iniFile *ini.File, cfg *Cfg) error {
users := iniFile.Section("users")
AllowUserSignUp = users.Key("allow_sign_up").MustBool(true)