Revert "MM-41211: Adds ability to set SessionLengthSSOInDays to a decimal. (#19396)" (#19563)

This reverts commit 7398451030.
Этот коммит содержится в:
mkraft
2022-02-15 12:50:56 -05:00
коммит произвёл GitHub
родитель 431a5fce59
Коммит 627dd650d6
15 изменённых файлов: 54 добавлений и 76 удалений

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

@@ -3,8 +3,7 @@
package model
func NewBool(b bool) *bool { return &b }
func NewInt(n int) *int { return &n }
func NewInt64(n int64) *int64 { return &n }
func NewString(s string) *string { return &s }
func NewFloat32(s float32) *float32 { return &s }
func NewBool(b bool) *bool { return &b }
func NewInt(n int) *int { return &n }
func NewInt64(n int64) *int64 { return &n }
func NewString(s string) *string { return &s }

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

@@ -320,7 +320,7 @@ type ServiceSettings struct {
ExtendSessionLengthWithActivity *bool `access:"environment_session_lengths,write_restrictable,cloud_restrictable"`
SessionLengthWebInDays *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"`
SessionLengthMobileInDays *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"`
SessionLengthSSOInDays *float32 `access:"environment_session_lengths,write_restrictable,cloud_restrictable"`
SessionLengthSSOInDays *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"`
SessionCacheInMinutes *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"`
SessionIdleTimeoutInMinutes *int `access:"environment_session_lengths,write_restrictable,cloud_restrictable"`
WebsocketSecurePort *int `access:"write_restrictable,cloud_restrictable"` // telemetry: none
@@ -368,18 +368,6 @@ type ServiceSettings struct {
ManagedResourcePaths *string `access:"environment_web_server,write_restrictable,cloud_restrictable"`
}
func (s *ServiceSettings) SessionLengthWebInHours() *int {
return NewInt(*s.SessionLengthWebInDays * 24)
}
func (s *ServiceSettings) SessionLengthMobileInHours() *int {
return NewInt(*s.SessionLengthMobileInDays * 24)
}
func (s *ServiceSettings) SessionLengthSSOInHours() *int {
return NewInt(int(*s.SessionLengthSSOInDays * 24))
}
func (s *ServiceSettings) SetDefaults(isUpdate bool) {
if s.EnableEmailInvitations == nil {
// If the site URL is also not present then assume this is a clean install
@@ -610,7 +598,7 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
}
if s.SessionLengthSSOInDays == nil {
s.SessionLengthSSOInDays = NewFloat32(30)
s.SessionLengthSSOInDays = NewInt(30)
}
if s.SessionCacheInMinutes == nil {
@@ -3596,10 +3584,6 @@ func (s *ServiceSettings) isValid() *AppError {
return NewAppError("Config.IsValid", "model.config.is_valid.collapsed_threads.app_error", nil, "", http.StatusBadRequest)
}
if *s.SessionLengthSSOInHours() < 1 {
return NewAppError("Config.IsValid", "model.config.is_valid.session_length_sso_in_days.app_error", nil, "", http.StatusBadRequest)
}
return nil
}

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

@@ -12,24 +12,24 @@ import (
)
const (
SessionCookieToken = "MMAUTHTOKEN"
SessionCookieUser = "MMUSERID"
SessionCookieCsrf = "MMCSRF"
SessionCookieCloudUrl = "MMCLOUDURL"
SessionCacheSize = 35000
SessionPropPlatform = "platform"
SessionPropOs = "os"
SessionPropBrowser = "browser"
SessionPropType = "type"
SessionPropUserAccessTokenId = "user_access_token_id"
SessionPropIsBot = "is_bot"
SessionPropIsBotValue = "true"
SessionTypeUserAccessToken = "UserAccessToken"
SessionTypeCloudKey = "CloudKey"
SessionTypeRemoteclusterToken = "RemoteClusterToken"
SessionPropIsGuest = "is_guest"
SessionActivityTimeoutMiliseconds = 1000 * 60 * 5 // 5 minutes
SessionUserAccessTokenExpiryHours = 100 * 365 * 24 // 100 years
SessionCookieToken = "MMAUTHTOKEN"
SessionCookieUser = "MMUSERID"
SessionCookieCsrf = "MMCSRF"
SessionCookieCloudUrl = "MMCLOUDURL"
SessionCacheSize = 35000
SessionPropPlatform = "platform"
SessionPropOs = "os"
SessionPropBrowser = "browser"
SessionPropType = "type"
SessionPropUserAccessTokenId = "user_access_token_id"
SessionPropIsBot = "is_bot"
SessionPropIsBotValue = "true"
SessionTypeUserAccessToken = "UserAccessToken"
SessionTypeCloudKey = "CloudKey"
SessionTypeRemoteclusterToken = "RemoteClusterToken"
SessionPropIsGuest = "is_guest"
SessionActivityTimeout = 1000 * 60 * 5 // 5 minutes
SessionUserAccessTokenExpiry = 100 * 365 // 100 years
)
//msgp StringMap