Auth: Separate anonymous settings to its own struct (#97791)

separate anonymous settings to its own struct
This commit is contained in:
Jo
2024-12-13 10:46:27 +01:00
committed by GitHub
parent fc7805957e
commit 40d3b02648
18 changed files with 75 additions and 53 deletions
+2 -11
View File
@@ -302,11 +302,7 @@ type Cfg struct {
// Deprecated: use featuremgmt.FeatureFlags
IsFeatureToggleEnabled func(key string) bool // filled in dynamically
AnonymousEnabled bool
AnonymousOrgName string
AnonymousOrgRole string
AnonymousHideVersion bool
AnonymousDeviceLimit int64
Anonymous AnonymousSettings
DateFormats DateFormats
@@ -1654,12 +1650,7 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
}
// anonymous access
anonSection := iniFile.Section("auth.anonymous")
cfg.AnonymousEnabled = anonSection.Key("enabled").MustBool(false)
cfg.AnonymousOrgName = valueAsString(anonSection, "org_name", "")
cfg.AnonymousOrgRole = valueAsString(anonSection, "org_role", "")
cfg.AnonymousHideVersion = anonSection.Key("hide_version").MustBool(false)
cfg.AnonymousDeviceLimit = anonSection.Key("device_limit").MustInt64(0)
cfg.readAnonymousSettings()
// basic auth
authBasic := iniFile.Section("auth.basic")