MM-41211: Replaces SessionLength*InDays with SessionLength*InHours. (#19838)

* MM-41211: Replaces SessionLength[Web|Mobile|SSO]InDays with SessionLength[Web|Mobile|SSO]InHours.

* MM-41211: Clear the value of the old config settings.
Этот коммит содержится в:
Martin Kraft
2022-04-28 17:31:35 -04:00
коммит произвёл GitHub
родитель 4bc2ed3973
Коммит cb3d8f0a1c
19 изменённых файлов: 198 добавлений и 168 удалений

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

@@ -307,22 +307,22 @@ func (a *App) GetSessionLengthInMillis(session *model.Session) int64 {
return 0
}
var days int
var hours int
if session.IsMobileApp() {
days = *a.Config().ServiceSettings.SessionLengthMobileInDays
hours = *a.Config().ServiceSettings.SessionLengthMobileInHours
} else if session.IsSSOLogin() {
days = *a.Config().ServiceSettings.SessionLengthSSOInDays
hours = *a.Config().ServiceSettings.SessionLengthSSOInHours
} else {
days = *a.Config().ServiceSettings.SessionLengthWebInDays
hours = *a.Config().ServiceSettings.SessionLengthWebInHours
}
return int64(days * 24 * 60 * 60 * 1000)
return int64(hours * 60 * 60 * 1000)
}
// SetSessionExpireInDays sets the session's expiry the specified number of days
// SetSessionExpireInHours sets the session's expiry the specified number of hours
// relative to either the session creation date or the current time, depending
// on the `ExtendSessionOnActivity` config setting.
func (a *App) SetSessionExpireInDays(session *model.Session, days int) {
a.ch.srv.userService.SetSessionExpireInDays(session, days)
func (a *App) SetSessionExpireInHours(session *model.Session, hours int) {
a.ch.srv.userService.SetSessionExpireInHours(session, hours)
}
func (a *App) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError) {
@@ -411,7 +411,7 @@ func (a *App) createSessionForUserAccessToken(tokenString string) (*model.Sessio
} else {
session.AddProp(model.SessionPropIsGuest, "false")
}
a.ch.srv.userService.SetSessionExpireInDays(session, model.SessionUserAccessTokenExpiry)
a.ch.srv.userService.SetSessionExpireInHours(session, model.SessionUserAccessTokenExpiryHours)
session, nErr = a.Srv().Store.Session().Save(session)
if nErr != nil {