Reduce utils.Cfg references (#7650)
* app.UpdateConfig method * test fix * another test fix * the config override option as-was is just error prone, remove it for now * derp
Этот коммит содержится в:
@@ -71,12 +71,12 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token}, "", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
if *utils.Cfg.ServiceSettings.SessionIdleTimeoutInMinutes > 0 &&
|
||||
if *a.Config().ServiceSettings.SessionIdleTimeoutInMinutes > 0 &&
|
||||
utils.IsLicensed() && *utils.License().Features.Compliance &&
|
||||
session != nil && !session.IsOAuth && !session.IsMobileApp() &&
|
||||
session.Props[model.SESSION_PROP_TYPE] != model.SESSION_TYPE_USER_ACCESS_TOKEN {
|
||||
|
||||
timeout := int64(*utils.Cfg.ServiceSettings.SessionIdleTimeoutInMinutes) * 1000 * 60
|
||||
timeout := int64(*a.Config().ServiceSettings.SessionIdleTimeoutInMinutes) * 1000 * 60
|
||||
if model.GetMillis()-session.LastActivityAt > timeout {
|
||||
a.RevokeSessionById(session.Id)
|
||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token}, "idle timeout", http.StatusUnauthorized)
|
||||
@@ -231,7 +231,7 @@ func (a *App) UpdateLastActivityAtIfNeeded(session model.Session) {
|
||||
}
|
||||
|
||||
func (a *App) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError) {
|
||||
if !*utils.Cfg.ServiceSettings.EnableUserAccessTokens {
|
||||
if !*a.Config().ServiceSettings.EnableUserAccessTokens {
|
||||
return nil, model.NewAppError("CreateUserAccessToken", "app.user_access_token.disabled", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ func (a *App) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAc
|
||||
}
|
||||
|
||||
func (a *App) createSessionForUserAccessToken(tokenString string) (*model.Session, *model.AppError) {
|
||||
if !*utils.Cfg.ServiceSettings.EnableUserAccessTokens {
|
||||
if !*a.Config().ServiceSettings.EnableUserAccessTokens {
|
||||
return nil, model.NewAppError("createSessionForUserAccessToken", "app.user_access_token.invalid_or_missing", nil, "EnableUserAccessTokens=false", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user