mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Users: Add config option to control how often last_seen is updated (#88721)
Users: Add config option to control how often last_seen is updated Co-authored-by: Karl Persson <kalle.persson92@gmail.com>
This commit is contained in:
@@ -306,6 +306,7 @@ type Cfg struct {
|
||||
UserInviteMaxLifetime time.Duration
|
||||
HiddenUsers map[string]struct{}
|
||||
CaseInsensitiveLogin bool // Login and Email will be considered case insensitive
|
||||
UserLastSeenUpdateInterval time.Duration
|
||||
VerificationEmailMaxLifetime time.Duration
|
||||
|
||||
// Service Accounts
|
||||
@@ -1695,6 +1696,19 @@ func readUserSettings(iniFile *ini.File, cfg *Cfg) error {
|
||||
return errors.New("the minimum supported value for the `user_invite_max_lifetime_duration` configuration is 15m (15 minutes)")
|
||||
}
|
||||
|
||||
cfg.UserLastSeenUpdateInterval, err = gtime.ParseDuration(valueAsString(users, "last_seen_update_interval", "15m"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.UserLastSeenUpdateInterval < time.Minute*5 {
|
||||
cfg.Logger.Warn("the minimum supported value for the `last_seen_update_interval` configuration is 5m (5 minutes)")
|
||||
cfg.UserLastSeenUpdateInterval = time.Minute * 5
|
||||
} else if cfg.UserLastSeenUpdateInterval > time.Hour*1 {
|
||||
cfg.Logger.Warn("the maximum supported value for the `last_seen_update_interval` configuration is 1h (1 hour)")
|
||||
cfg.UserLastSeenUpdateInterval = time.Hour * 1
|
||||
}
|
||||
|
||||
cfg.HiddenUsers = make(map[string]struct{})
|
||||
hiddenUsers := users.Key("hidden_users").MustString("")
|
||||
for _, user := range strings.Split(hiddenUsers, ",") {
|
||||
|
||||
Reference in New Issue
Block a user