Deactivating and invalidating sessions of guest users on guest disable (#13007)

Automatic Merge
Этот коммит содержится в:
Jesús Espino
2019-11-15 15:43:52 +01:00
коммит произвёл mattermod
родитель 6a75d2fc68
Коммит 7031f51b41
11 изменённых файлов: 285 добавлений и 9 удалений

Просмотреть файл

@@ -261,6 +261,21 @@ func NewServer(options ...Option) (*Server, error) {
s.StartElasticsearch()
}
s.AddConfigListener(func(oldConfig *model.Config, newConfig *model.Config) {
if *oldConfig.GuestAccountsSettings.Enable && !*newConfig.GuestAccountsSettings.Enable {
if appErr := s.FakeApp().DeactivateGuests(); appErr != nil {
mlog.Error("Unable to deactivate guest accounts", mlog.Err(appErr))
}
}
})
// Disable active guest accounts on first run if guest accounts are disabled
if !*s.Config().GuestAccountsSettings.Enable {
if appErr := s.FakeApp().DeactivateGuests(); appErr != nil {
mlog.Error("Unable to deactivate guest accounts", mlog.Err(appErr))
}
}
s.initJobs()
if s.runjobs {