diff options
author | Chris <ccbrown112@gmail.com> | 2017-10-18 15:36:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-18 15:36:43 -0700 |
commit | 8e19ba029f889519d93cf272960dce858971106c (patch) | |
tree | d8f38ac62661fb8578e2b5c3c619fe31ab29f480 /app/session.go | |
parent | 34a87fa8f47b1447b73e3ae56866b654801b3eee (diff) | |
download | chat-8e19ba029f889519d93cf272960dce858971106c.tar.gz chat-8e19ba029f889519d93cf272960dce858971106c.tar.bz2 chat-8e19ba029f889519d93cf272960dce858971106c.zip |
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
Diffstat (limited to 'app/session.go')
-rw-r--r-- | app/session.go | 8 |
1 files changed, 4 insertions, 4 deletions
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) } |