From 8e19ba029f889519d93cf272960dce858971106c Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 18 Oct 2017 15:36:43 -0700 Subject: 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 --- app/session.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/session.go') diff --git a/app/session.go b/app/session.go index be79b0266..f8b931043 100644 --- a/app/session.go +++ b/app/session.go @@ -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) } -- cgit v1.2.3-1-g7c22