коммит произвёл
GitHub
родитель
b15c0484c6
Коммит
87dfbc13c0
@@ -4,6 +4,8 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||||
"github.com/mattermost/mattermost-server/v5/model"
|
"github.com/mattermost/mattermost-server/v5/model"
|
||||||
"github.com/mattermost/mattermost-server/v5/store"
|
"github.com/mattermost/mattermost-server/v5/store"
|
||||||
@@ -251,7 +253,7 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
|||||||
sessionChan := make(chan store.StoreResult, 1)
|
sessionChan := make(chan store.StoreResult, 1)
|
||||||
go func() {
|
go func() {
|
||||||
count, err := a.Srv().Store.Session().AnalyticsSessionCount()
|
count, err := a.Srv().Store.Session().AnalyticsSessionCount()
|
||||||
sessionChan <- store.StoreResult{Data: count, Err: err}
|
sessionChan <- store.StoreResult{Data: count, NErr: err}
|
||||||
close(sessionChan)
|
close(sessionChan)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -313,8 +315,8 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
|||||||
rows[4].Value = float64(r.Data.(int64))
|
rows[4].Value = float64(r.Data.(int64))
|
||||||
|
|
||||||
r = <-sessionChan
|
r = <-sessionChan
|
||||||
if r.Err != nil {
|
if r.NErr != nil {
|
||||||
return nil, r.Err
|
return nil, model.NewAppError("GetAnalytics", "app.session.analytics_session_count.app_error", nil, r.NErr.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
rows[5].Value = float64(r.Data.(int64))
|
rows[5].Value = float64(r.Data.(int64))
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||||
"github.com/mattermost/mattermost-server/v5/model"
|
"github.com/mattermost/mattermost-server/v5/model"
|
||||||
"github.com/mattermost/mattermost-server/v5/utils"
|
"github.com/mattermost/mattermost-server/v5/utils"
|
||||||
@@ -26,7 +28,7 @@ func (a *App) NotifySessionsExpired() *model.AppError {
|
|||||||
// Get all mobile sessions that expired within the last hour.
|
// Get all mobile sessions that expired within the last hour.
|
||||||
sessions, err := a.srv.Store.Session().GetSessionsExpired(OneHourMillis, true, true)
|
sessions, err := a.srv.Store.Session().GetSessionsExpired(OneHourMillis, true, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return model.NewAppError("NotifySessionsExpired", "app.session.analytics_session_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := &model.PushNotification{
|
msg := &model.PushNotification{
|
||||||
|
|||||||
@@ -386,7 +386,12 @@ func (a *App) SendAckToPushProxy(ack *model.PushNotificationAck) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) getMobileAppSessions(userId string) ([]*model.Session, *model.AppError) {
|
func (a *App) getMobileAppSessions(userId string) ([]*model.Session, *model.AppError) {
|
||||||
return a.Srv().Store.Session().GetSessionsWithActiveDeviceIds(userId)
|
sessions, err := a.Srv().Store.Session().GetSessionsWithActiveDeviceIds(userId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, model.NewAppError("getMobileAppSessions", "app.session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
|
||||||
|
return sessions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShouldSendPushNotification(user *model.User, channelNotifyProps model.StringMap, wasMentioned bool, status *model.Status, post *model.Post) bool {
|
func ShouldSendPushNotification(user *model.User, channelNotifyProps model.StringMap, wasMentioned bool, status *model.Status, post *model.Post) bool {
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ func (a *App) RegenerateOAuthAppSecret(app *model.OAuthApp) (*model.OAuthApp, *m
|
|||||||
func (a *App) RevokeAccessToken(token string) *model.AppError {
|
func (a *App) RevokeAccessToken(token string) *model.AppError {
|
||||||
session, _ := a.GetSession(token)
|
session, _ := a.GetSession(token)
|
||||||
|
|
||||||
schan := make(chan *model.AppError, 1)
|
schan := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
schan <- a.Srv().Store.Session().Remove(token)
|
schan <- a.Srv().Store.Session().Remove(token)
|
||||||
close(schan)
|
close(schan)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
@@ -11,6 +12,7 @@ import (
|
|||||||
"github.com/mattermost/mattermost-server/v5/audit"
|
"github.com/mattermost/mattermost-server/v5/audit"
|
||||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||||
"github.com/mattermost/mattermost-server/v5/model"
|
"github.com/mattermost/mattermost-server/v5/model"
|
||||||
|
"github.com/mattermost/mattermost-server/v5/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *App) CreateSession(session *model.Session) (*model.Session, *model.AppError) {
|
func (a *App) CreateSession(session *model.Session) (*model.Session, *model.AppError) {
|
||||||
@@ -18,7 +20,13 @@ func (a *App) CreateSession(session *model.Session) (*model.Session, *model.AppE
|
|||||||
|
|
||||||
session, err := a.Srv().Store.Session().Save(session)
|
session, err := a.Srv().Store.Session().Save(session)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
var invErr *store.ErrInvalidInput
|
||||||
|
switch {
|
||||||
|
case errors.As(err, &invErr):
|
||||||
|
return nil, model.NewAppError("CreateSession", "app.session.save.existing.app_error", nil, invErr.Error(), http.StatusBadRequest)
|
||||||
|
default:
|
||||||
|
return nil, model.NewAppError("CreateSession", "app.session.save.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a.AddSessionToCache(session)
|
a.AddSessionToCache(session)
|
||||||
@@ -42,7 +50,8 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if session == nil {
|
if session == nil {
|
||||||
if session, err = a.Srv().Store.Session().Get(token); err == nil {
|
var nErr error
|
||||||
|
if session, nErr = a.Srv().Store.Session().Get(token); nErr == nil {
|
||||||
if session != nil {
|
if session != nil {
|
||||||
if session.Token != token {
|
if session.Token != token {
|
||||||
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "", http.StatusUnauthorized)
|
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token, "Error": ""}, "", http.StatusUnauthorized)
|
||||||
@@ -52,8 +61,8 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
|||||||
a.AddSessionToCache(session)
|
a.AddSessionToCache(session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if err.StatusCode == http.StatusInternalServerError {
|
} else if nfErr := new(store.ErrNotFound); !errors.As(nErr, &nfErr) {
|
||||||
return nil, err
|
return nil, model.NewAppError("GetSession", "app.session.get.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +100,12 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
|||||||
|
|
||||||
func (a *App) GetSessions(userId string) ([]*model.Session, *model.AppError) {
|
func (a *App) GetSessions(userId string) ([]*model.Session, *model.AppError) {
|
||||||
|
|
||||||
return a.Srv().Store.Session().GetSessions(userId)
|
sessions, err := a.Srv().Store.Session().GetSessions(userId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, model.NewAppError("GetSessions", "app.session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
|
||||||
|
return sessions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) UpdateSessionsIsGuest(userId string, isGuest bool) {
|
func (a *App) UpdateSessionsIsGuest(userId string, isGuest bool) {
|
||||||
@@ -118,14 +132,14 @@ func (a *App) UpdateSessionsIsGuest(userId string, isGuest bool) {
|
|||||||
func (a *App) RevokeAllSessions(userId string) *model.AppError {
|
func (a *App) RevokeAllSessions(userId string) *model.AppError {
|
||||||
sessions, err := a.Srv().Store.Session().GetSessions(userId)
|
sessions, err := a.Srv().Store.Session().GetSessions(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return model.NewAppError("RevokeAllSessions", "app.session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
for _, session := range sessions {
|
for _, session := range sessions {
|
||||||
if session.IsOAuth {
|
if session.IsOAuth {
|
||||||
a.RevokeAccessToken(session.Token)
|
a.RevokeAccessToken(session.Token)
|
||||||
} else {
|
} else {
|
||||||
if err := a.Srv().Store.Session().Remove(session.Id); err != nil {
|
if err := a.Srv().Store.Session().Remove(session.Id); err != nil {
|
||||||
return err
|
return model.NewAppError("RevokeAllSessions", "app.session.remove.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +159,7 @@ func (a *App) RevokeSessionsFromAllUsers() *model.AppError {
|
|||||||
}
|
}
|
||||||
err := a.Srv().Store.Session().RemoveAllSessions()
|
err := a.Srv().Store.Session().RemoveAllSessions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return model.NewAppError("RevokeSessionsFromAllUsers", "app.session.remove_all_sessions_for_team.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
a.ClearSessionCacheForAllUsers()
|
a.ClearSessionCacheForAllUsers()
|
||||||
|
|
||||||
@@ -214,7 +228,7 @@ func (a *App) SessionCacheLength() int {
|
|||||||
func (a *App) RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId string) *model.AppError {
|
func (a *App) RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId string) *model.AppError {
|
||||||
sessions, err := a.Srv().Store.Session().GetSessions(userId)
|
sessions, err := a.Srv().Store.Session().GetSessions(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return model.NewAppError("RevokeSessionsForDeviceId", "app.session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
for _, session := range sessions {
|
for _, session := range sessions {
|
||||||
if session.DeviceId == deviceId && session.Id != currentSessionId {
|
if session.DeviceId == deviceId && session.Id != currentSessionId {
|
||||||
@@ -232,17 +246,16 @@ func (a *App) RevokeSessionsForDeviceId(userId string, deviceId string, currentS
|
|||||||
func (a *App) GetSessionById(sessionId string) (*model.Session, *model.AppError) {
|
func (a *App) GetSessionById(sessionId string) (*model.Session, *model.AppError) {
|
||||||
session, err := a.Srv().Store.Session().Get(sessionId)
|
session, err := a.Srv().Store.Session().Get(sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err.StatusCode = http.StatusBadRequest
|
return nil, model.NewAppError("GetSessionById", "app.session.get.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return session, nil
|
return session, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) RevokeSessionById(sessionId string) *model.AppError {
|
func (a *App) RevokeSessionById(sessionId string) *model.AppError {
|
||||||
session, err := a.Srv().Store.Session().Get(sessionId)
|
session, err := a.Srv().Store.Session().Get(sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err.StatusCode = http.StatusBadRequest
|
return model.NewAppError("RevokeSessionById", "app.session.get.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
return a.RevokeSession(session)
|
return a.RevokeSession(session)
|
||||||
|
|
||||||
@@ -255,7 +268,7 @@ func (a *App) RevokeSession(session *model.Session) *model.AppError {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := a.Srv().Store.Session().Remove(session.Id); err != nil {
|
if err := a.Srv().Store.Session().Remove(session.Id); err != nil {
|
||||||
return err
|
return model.NewAppError("RevokeSession", "app.session.remove.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +280,7 @@ func (a *App) RevokeSession(session *model.Session) *model.AppError {
|
|||||||
func (a *App) AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError {
|
func (a *App) AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError {
|
||||||
_, err := a.Srv().Store.Session().UpdateDeviceId(sessionId, deviceId, expiresAt)
|
_, err := a.Srv().Store.Session().UpdateDeviceId(sessionId, deviceId, expiresAt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return model.NewAppError("AttachDeviceId", "app.session.update_device_id.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -427,9 +440,15 @@ func (a *App) createSessionForUserAccessToken(tokenString string) (*model.Sessio
|
|||||||
}
|
}
|
||||||
session.SetExpireInDays(model.SESSION_USER_ACCESS_TOKEN_EXPIRY)
|
session.SetExpireInDays(model.SESSION_USER_ACCESS_TOKEN_EXPIRY)
|
||||||
|
|
||||||
session, err = a.Srv().Store.Session().Save(session)
|
session, nErr := a.Srv().Store.Session().Save(session)
|
||||||
if err != nil {
|
if nErr != nil {
|
||||||
return nil, err
|
var invErr *store.ErrInvalidInput
|
||||||
|
switch {
|
||||||
|
case errors.As(nErr, &invErr):
|
||||||
|
return nil, model.NewAppError("CreateSession", "app.session.save.existing.app_error", nil, invErr.Error(), http.StatusBadRequest)
|
||||||
|
default:
|
||||||
|
return nil, model.NewAppError("CreateSession", "app.session.save.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a.AddSessionToCache(session)
|
a.AddSessionToCache(session)
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
|
|||||||
|
|
||||||
// Test regular session, should timeout
|
// Test regular session, should timeout
|
||||||
time := session.LastActivityAt - (1000 * 60 * 6)
|
time := session.LastActivityAt - (1000 * 60 * 6)
|
||||||
err = th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
nErr := th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
||||||
require.Nil(t, err)
|
require.Nil(t, nErr)
|
||||||
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
||||||
|
|
||||||
rsession, err = th.App.GetSession(session.Token)
|
rsession, err = th.App.GetSession(session.Token)
|
||||||
@@ -88,8 +88,8 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
|
|||||||
|
|
||||||
session, _ = th.App.CreateSession(session)
|
session, _ = th.App.CreateSession(session)
|
||||||
time = session.LastActivityAt - (1000 * 60 * 6)
|
time = session.LastActivityAt - (1000 * 60 * 6)
|
||||||
err = th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
nErr = th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
||||||
require.Nil(t, err)
|
require.Nil(t, nErr)
|
||||||
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
||||||
|
|
||||||
_, err = th.App.GetSession(session.Token)
|
_, err = th.App.GetSession(session.Token)
|
||||||
@@ -103,8 +103,8 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
|
|||||||
|
|
||||||
session, _ = th.App.CreateSession(session)
|
session, _ = th.App.CreateSession(session)
|
||||||
time = session.LastActivityAt - (1000 * 60 * 6)
|
time = session.LastActivityAt - (1000 * 60 * 6)
|
||||||
err = th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
nErr = th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
||||||
require.Nil(t, err)
|
require.Nil(t, nErr)
|
||||||
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
||||||
|
|
||||||
_, err = th.App.GetSession(session.Token)
|
_, err = th.App.GetSession(session.Token)
|
||||||
@@ -121,8 +121,8 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
|
|||||||
|
|
||||||
session, _ = th.App.CreateSession(session)
|
session, _ = th.App.CreateSession(session)
|
||||||
time = session.LastActivityAt - (1000 * 60 * 6)
|
time = session.LastActivityAt - (1000 * 60 * 6)
|
||||||
err = th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
nErr = th.App.Srv().Store.Session().UpdateLastActivityAt(session.Id, time)
|
||||||
require.Nil(t, err)
|
require.Nil(t, nErr)
|
||||||
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
th.App.ClearSessionCacheForUserSkipClusterSend(session.UserId)
|
||||||
|
|
||||||
_, err = th.App.GetSession(session.Token)
|
_, err = th.App.GetSession(session.Token)
|
||||||
@@ -343,8 +343,8 @@ func TestApp_ExtendExpiryIfNeeded(t *testing.T) {
|
|||||||
require.Equal(t, session.ExpiresAt, cachedSession.ExpiresAt)
|
require.Equal(t, session.ExpiresAt, cachedSession.ExpiresAt)
|
||||||
|
|
||||||
// check database was updated.
|
// check database was updated.
|
||||||
storedSession, err := th.App.Srv().Store.Session().Get(session.Token)
|
storedSession, nErr := th.App.Srv().Store.Session().Get(session.Token)
|
||||||
require.Nil(t, err)
|
require.Nil(t, nErr)
|
||||||
require.Equal(t, session.ExpiresAt, storedSession.ExpiresAt)
|
require.Equal(t, session.ExpiresAt, storedSession.ExpiresAt)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1414,7 +1414,7 @@ func (a *App) UpdateUserRoles(userId string, newRoles string, sendWebSocketEvent
|
|||||||
schan := make(chan store.StoreResult, 1)
|
schan := make(chan store.StoreResult, 1)
|
||||||
go func() {
|
go func() {
|
||||||
id, err := a.Srv().Store.Session().UpdateRoles(user.Id, newRoles)
|
id, err := a.Srv().Store.Session().UpdateRoles(user.Id, newRoles)
|
||||||
schan <- store.StoreResult{Data: id, Err: err}
|
schan <- store.StoreResult{Data: id, NErr: err}
|
||||||
close(schan)
|
close(schan)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -1424,9 +1424,9 @@ func (a *App) UpdateUserRoles(userId string, newRoles string, sendWebSocketEvent
|
|||||||
}
|
}
|
||||||
ruser := result.Data.(*model.UserUpdate).New
|
ruser := result.Data.(*model.UserUpdate).New
|
||||||
|
|
||||||
if result := <-schan; result.Err != nil {
|
if result := <-schan; result.NErr != nil {
|
||||||
// soft error since the user roles were still updated
|
// soft error since the user roles were still updated
|
||||||
mlog.Error("Failed during updating user roles", mlog.Err(result.Err))
|
mlog.Error("Failed during updating user roles", mlog.Err(result.NErr))
|
||||||
}
|
}
|
||||||
|
|
||||||
a.InvalidateCacheForUser(userId)
|
a.InvalidateCacheForUser(userId)
|
||||||
@@ -1453,7 +1453,7 @@ func (a *App) PermanentDeleteUser(user *model.User) *model.AppError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := a.Srv().Store.Session().PermanentDeleteSessionsByUser(user.Id); err != nil {
|
if err := a.Srv().Store.Session().PermanentDeleteSessionsByUser(user.Id); err != nil {
|
||||||
return err
|
return model.NewAppError("PermanentDeleteUser", "app.session.permanent_delete_sessions_by_user.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := a.Srv().Store.UserAccessToken().DeleteAllForUser(user.Id); err != nil {
|
if err := a.Srv().Store.UserAccessToken().DeleteAllForUser(user.Id); err != nil {
|
||||||
|
|||||||
92
i18n/en.json
92
i18n/en.json
@@ -4022,6 +4022,42 @@
|
|||||||
"id": "app.schemes.is_phase_2_migration_completed.not_completed.app_error",
|
"id": "app.schemes.is_phase_2_migration_completed.not_completed.app_error",
|
||||||
"translation": "This API endpoint is not accessible as required migrations have not yet completed."
|
"translation": "This API endpoint is not accessible as required migrations have not yet completed."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.analytics_session_count.app_error",
|
||||||
|
"translation": "Unable to count the sessions."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.get.app_error",
|
||||||
|
"translation": "We encountered an error finding the session."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.get_sessions.app_error",
|
||||||
|
"translation": "We encountered an error while finding user sessions."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.permanent_delete_sessions_by_user.app_error",
|
||||||
|
"translation": "Unable to remove all the sessions for the user."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.remove.app_error",
|
||||||
|
"translation": "Unable to remove the session."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.remove_all_sessions_for_team.app_error",
|
||||||
|
"translation": "Unable to remove all the sessions."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.save.app_error",
|
||||||
|
"translation": "Unable to save the session."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.save.existing.app_error",
|
||||||
|
"translation": "Unable to update existing session."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.session.update_device_id.app_error",
|
||||||
|
"translation": "Unable to update the device id."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "app.submit_interactive_dialog.json_error",
|
"id": "app.submit_interactive_dialog.json_error",
|
||||||
"translation": "Encountered an error encoding JSON for the interactive dialog."
|
"translation": "Encountered an error encoding JSON for the interactive dialog."
|
||||||
@@ -6998,62 +7034,6 @@
|
|||||||
"id": "store.sql_role.save_role.commit_transaction.app_error",
|
"id": "store.sql_role.save_role.commit_transaction.app_error",
|
||||||
"translation": "Failed to commit the transaction to save the role."
|
"translation": "Failed to commit the transaction to save the role."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "store.sql_session.analytics_session_count.app_error",
|
|
||||||
"translation": "Unable to count the sessions."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.get.app_error",
|
|
||||||
"translation": "We encountered an error finding the session."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.get_sessions.app_error",
|
|
||||||
"translation": "We encountered an error while finding user sessions."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.permanent_delete_sessions_by_user.app_error",
|
|
||||||
"translation": "Unable to remove all the sessions for the user."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.remove.app_error",
|
|
||||||
"translation": "Unable to remove the session."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.remove_all_sessions_for_team.app_error",
|
|
||||||
"translation": "Unable to remove all the sessions."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.save.app_error",
|
|
||||||
"translation": "Unable to save the session."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.save.existing.app_error",
|
|
||||||
"translation": "Unable to update existing session."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.update_device_id.app_error",
|
|
||||||
"translation": "Unable to update the device id."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.update_expired_notify.app_error",
|
|
||||||
"translation": "Unable to update expired_notify."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.update_expires_at.app_error",
|
|
||||||
"translation": "Unable to update expires_at."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.update_last_activity.app_error",
|
|
||||||
"translation": "Unable to update the last_activity_at."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.update_props.app_error",
|
|
||||||
"translation": "Unable to update session props."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "store.sql_session.update_roles.app_error",
|
|
||||||
"translation": "Unable to update the roles."
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "store.sql_status.get.app_error",
|
"id": "store.sql_status.get.app_error",
|
||||||
"translation": "Encountered an error retrieving the status."
|
"translation": "Encountered an error retrieving the status."
|
||||||
|
|||||||
@@ -5958,7 +5958,7 @@ func (s *OpenTracingLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme,
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.AnalyticsSessionCount")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.AnalyticsSessionCount")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -5989,7 +5989,7 @@ func (s *OpenTracingLayerSessionStore) Cleanup(expiryTime int64, batchSize int64
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) Get(sessionIdOrToken string) (*model.Session, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) Get(sessionIdOrToken string) (*model.Session, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Get")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Get")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6007,7 +6007,7 @@ func (s *OpenTracingLayerSessionStore) Get(sessionIdOrToken string) (*model.Sess
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) GetSessions(userId string) ([]*model.Session, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) GetSessions(userId string) ([]*model.Session, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessions")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessions")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6025,7 +6025,7 @@ func (s *OpenTracingLayerSessionStore) GetSessions(userId string) ([]*model.Sess
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessionsExpired")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessionsExpired")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6043,7 +6043,7 @@ func (s *OpenTracingLayerSessionStore) GetSessionsExpired(thresholdMillis int64,
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessionsWithActiveDeviceIds")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessionsWithActiveDeviceIds")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6061,7 +6061,7 @@ func (s *OpenTracingLayerSessionStore) GetSessionsWithActiveDeviceIds(userId str
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) *model.AppError {
|
func (s *OpenTracingLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) error {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.PermanentDeleteSessionsByUser")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.PermanentDeleteSessionsByUser")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6079,7 +6079,7 @@ func (s *OpenTracingLayerSessionStore) PermanentDeleteSessionsByUser(teamId stri
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) Remove(sessionIdOrToken string) *model.AppError {
|
func (s *OpenTracingLayerSessionStore) Remove(sessionIdOrToken string) error {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Remove")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Remove")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6097,7 +6097,7 @@ func (s *OpenTracingLayerSessionStore) Remove(sessionIdOrToken string) *model.Ap
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) RemoveAllSessions() *model.AppError {
|
func (s *OpenTracingLayerSessionStore) RemoveAllSessions() error {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.RemoveAllSessions")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.RemoveAllSessions")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6115,7 +6115,7 @@ func (s *OpenTracingLayerSessionStore) RemoveAllSessions() *model.AppError {
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) Save(session *model.Session) (*model.Session, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) Save(session *model.Session) (*model.Session, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Save")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Save")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6133,7 +6133,7 @@ func (s *OpenTracingLayerSessionStore) Save(session *model.Session) (*model.Sess
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateDeviceId")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateDeviceId")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6151,7 +6151,7 @@ func (s *OpenTracingLayerSessionStore) UpdateDeviceId(id string, deviceId string
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) *model.AppError {
|
func (s *OpenTracingLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) error {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateExpiredNotify")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateExpiredNotify")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6169,7 +6169,7 @@ func (s *OpenTracingLayerSessionStore) UpdateExpiredNotify(sessionid string, not
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
|
func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) error {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateExpiresAt")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateExpiresAt")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6187,7 +6187,7 @@ func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionId string, time in
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) UpdateLastActivityAt(sessionId string, time int64) *model.AppError {
|
func (s *OpenTracingLayerSessionStore) UpdateLastActivityAt(sessionId string, time int64) error {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateLastActivityAt")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateLastActivityAt")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6205,7 +6205,7 @@ func (s *OpenTracingLayerSessionStore) UpdateLastActivityAt(sessionId string, ti
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
func (s *OpenTracingLayerSessionStore) UpdateProps(session *model.Session) error {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateProps")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateProps")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
@@ -6223,7 +6223,7 @@ func (s *OpenTracingLayerSessionStore) UpdateProps(session *model.Session) *mode
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OpenTracingLayerSessionStore) UpdateRoles(userId string, roles string) (string, *model.AppError) {
|
func (s *OpenTracingLayerSessionStore) UpdateRoles(userId string, roles string) (string, error) {
|
||||||
origCtx := s.Root.Store.Context()
|
origCtx := s.Root.Store.Context()
|
||||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateRoles")
|
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateRoles")
|
||||||
s.Root.Store.SetContext(newCtx)
|
s.Root.Store.SetContext(newCtx)
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
package sqlstore
|
package sqlstore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
sq "github.com/Masterminds/squirrel"
|
sq "github.com/Masterminds/squirrel"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||||
"github.com/mattermost/mattermost-server/v5/model"
|
"github.com/mattermost/mattermost-server/v5/model"
|
||||||
"github.com/mattermost/mattermost-server/v5/store"
|
"github.com/mattermost/mattermost-server/v5/store"
|
||||||
@@ -45,19 +47,19 @@ func (me SqlSessionStore) createIndexesIfNotExists() {
|
|||||||
me.CreateIndexIfNotExists("idx_sessions_last_activity_at", "Sessions", "LastActivityAt")
|
me.CreateIndexIfNotExists("idx_sessions_last_activity_at", "Sessions", "LastActivityAt")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) Save(session *model.Session) (*model.Session, *model.AppError) {
|
func (me SqlSessionStore) Save(session *model.Session) (*model.Session, error) {
|
||||||
if len(session.Id) > 0 {
|
if len(session.Id) > 0 {
|
||||||
return nil, model.NewAppError("SqlSessionStore.Save", "store.sql_session.save.existing.app_error", nil, "id="+session.Id, http.StatusBadRequest)
|
return nil, store.NewErrInvalidInput("Session", "id", session.Id)
|
||||||
}
|
}
|
||||||
session.PreSave()
|
session.PreSave()
|
||||||
|
|
||||||
if err := me.GetMaster().Insert(session); err != nil {
|
if err := me.GetMaster().Insert(session); err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.Save", "store.sql_session.save.app_error", nil, "id="+session.Id+", "+err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrapf(err, "failed to save Session with id=%s", session.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
teamMembers, err := me.Team().GetTeamsForUser(session.UserId)
|
teamMembers, err := me.Team().GetTeamsForUser(session.UserId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.Save", "store.sql_session.save.app_error", nil, "id="+session.Id+", "+err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrapf(err, "failed to find TeamMembers for Session with userId=%s", session.UserId)
|
||||||
}
|
}
|
||||||
|
|
||||||
session.TeamMembers = make([]*model.TeamMember, 0, len(teamMembers))
|
session.TeamMembers = make([]*model.TeamMember, 0, len(teamMembers))
|
||||||
@@ -70,19 +72,19 @@ func (me SqlSessionStore) Save(session *model.Session) (*model.Session, *model.A
|
|||||||
return session, nil
|
return session, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) Get(sessionIdOrToken string) (*model.Session, *model.AppError) {
|
func (me SqlSessionStore) Get(sessionIdOrToken string) (*model.Session, error) {
|
||||||
var sessions []*model.Session
|
var sessions []*model.Session
|
||||||
|
|
||||||
if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE Token = :Token OR Id = :Id LIMIT 1", map[string]interface{}{"Token": sessionIdOrToken, "Id": sessionIdOrToken}); err != nil {
|
if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE Token = :Token OR Id = :Id LIMIT 1", map[string]interface{}{"Token": sessionIdOrToken, "Id": sessionIdOrToken}); err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.Get", "store.sql_session.get.app_error", nil, "sessionIdOrToken="+sessionIdOrToken+", "+err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrapf(err, "failed to find Sessions with sessionIdOrToken=%s", sessionIdOrToken)
|
||||||
} else if len(sessions) == 0 {
|
} else if len(sessions) == 0 {
|
||||||
return nil, model.NewAppError("SqlSessionStore.Get", "store.sql_session.get.app_error", nil, "sessionIdOrToken="+sessionIdOrToken, http.StatusNotFound)
|
return nil, store.NewErrNotFound("Session", fmt.Sprintf("sessionIdOrToken=%s", sessionIdOrToken))
|
||||||
}
|
}
|
||||||
session := sessions[0]
|
session := sessions[0]
|
||||||
|
|
||||||
tempMembers, err := me.Team().GetTeamsForUser(sessions[0].UserId)
|
tempMembers, err := me.Team().GetTeamsForUser(session.UserId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.Get", "store.sql_session.get.app_error", nil, "sessionIdOrToken="+sessionIdOrToken+", "+err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrapf(err, "failed to find TeamMembers for Session with userId=%s", session.UserId)
|
||||||
}
|
}
|
||||||
sessions[0].TeamMembers = make([]*model.TeamMember, 0, len(tempMembers))
|
sessions[0].TeamMembers = make([]*model.TeamMember, 0, len(tempMembers))
|
||||||
for _, tm := range tempMembers {
|
for _, tm := range tempMembers {
|
||||||
@@ -93,16 +95,16 @@ func (me SqlSessionStore) Get(sessionIdOrToken string) (*model.Session, *model.A
|
|||||||
return session, nil
|
return session, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) GetSessions(userId string) ([]*model.Session, *model.AppError) {
|
func (me SqlSessionStore) GetSessions(userId string) ([]*model.Session, error) {
|
||||||
var sessions []*model.Session
|
var sessions []*model.Session
|
||||||
|
|
||||||
if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE UserId = :UserId ORDER BY LastActivityAt DESC", map[string]interface{}{"UserId": userId}); err != nil {
|
if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE UserId = :UserId ORDER BY LastActivityAt DESC", map[string]interface{}{"UserId": userId}); err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.GetSessions", "store.sql_session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrapf(err, "failed to find Sessions with userId=%s", userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
teamMembers, err := me.Team().GetTeamsForUser(userId)
|
teamMembers, err := me.Team().GetTeamsForUser(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.GetSessions", "store.sql_session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrapf(err, "failed to find TeamMembers for Session with userId=%s", userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, session := range sessions {
|
for _, session := range sessions {
|
||||||
@@ -116,7 +118,7 @@ func (me SqlSessionStore) GetSessions(userId string) ([]*model.Session, *model.A
|
|||||||
return sessions, nil
|
return sessions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError) {
|
func (me SqlSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error) {
|
||||||
query :=
|
query :=
|
||||||
`SELECT *
|
`SELECT *
|
||||||
FROM
|
FROM
|
||||||
@@ -131,12 +133,12 @@ func (me SqlSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*mode
|
|||||||
|
|
||||||
_, err := me.GetReplica().Select(&sessions, query, map[string]interface{}{"UserId": userId, "ExpiresAt": model.GetMillis()})
|
_, err := me.GetReplica().Select(&sessions, query, map[string]interface{}{"UserId": userId, "ExpiresAt": model.GetMillis()})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.GetActiveSessionsWithDeviceIds", "store.sql_session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrapf(err, "failed to find Sessions with userId=%s", userId)
|
||||||
}
|
}
|
||||||
return sessions, nil
|
return sessions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, *model.AppError) {
|
func (me SqlSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) {
|
||||||
now := model.GetMillis()
|
now := model.GetMillis()
|
||||||
builder := me.getQueryBuilder().
|
builder := me.getQueryBuilder().
|
||||||
Select("*").
|
Select("*").
|
||||||
@@ -153,97 +155,97 @@ func (me SqlSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly b
|
|||||||
|
|
||||||
query, args, err := builder.ToSql()
|
query, args, err := builder.ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.GetSessionsExpired", "store.sql.build_query.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrap(err, "sessions_tosql")
|
||||||
}
|
}
|
||||||
|
|
||||||
var sessions []*model.Session
|
var sessions []*model.Session
|
||||||
|
|
||||||
_, err = me.GetReplica().Select(&sessions, query, args...)
|
_, err = me.GetReplica().Select(&sessions, query, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, model.NewAppError("SqlSessionStore.GetSessionsExpired", "store.sql_session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return nil, errors.Wrap(err, "failed to find Sessions")
|
||||||
}
|
}
|
||||||
return sessions, nil
|
return sessions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) UpdateExpiredNotify(sessionId string, notified bool) *model.AppError {
|
func (me SqlSessionStore) UpdateExpiredNotify(sessionId string, notified bool) error {
|
||||||
query, args, err := me.getQueryBuilder().
|
query, args, err := me.getQueryBuilder().
|
||||||
Update("Sessions").
|
Update("Sessions").
|
||||||
Set("ExpiredNotify", notified).
|
Set("ExpiredNotify", notified).
|
||||||
Where(sq.Eq{"Id": sessionId}).
|
Where(sq.Eq{"Id": sessionId}).
|
||||||
ToSql()
|
ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.UpdateExpiredNotifyAt", "store.sql.build_query.app_error", nil, "sessionId="+sessionId, http.StatusInternalServerError)
|
return errors.Wrap(err, "sessions_tosql")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = me.GetMaster().Exec(query, args...)
|
_, err = me.GetMaster().Exec(query, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.UpdateExpiredNotifyAt", "store.sql_session.update_expired_notify.app_error", nil, "sessionId="+sessionId, http.StatusInternalServerError)
|
return errors.Wrapf(err, "failed to update Session with id=%s", sessionId)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) Remove(sessionIdOrToken string) *model.AppError {
|
func (me SqlSessionStore) Remove(sessionIdOrToken string) error {
|
||||||
_, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE Id = :Id Or Token = :Token", map[string]interface{}{"Id": sessionIdOrToken, "Token": sessionIdOrToken})
|
_, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE Id = :Id Or Token = :Token", map[string]interface{}{"Id": sessionIdOrToken, "Token": sessionIdOrToken})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.RemoveSession", "store.sql_session.remove.app_error", nil, "id="+sessionIdOrToken+", err="+err.Error(), http.StatusInternalServerError)
|
return errors.Wrapf(err, "failed to delete Session with sessionIdOrToken=%s", sessionIdOrToken)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) RemoveAllSessions() *model.AppError {
|
func (me SqlSessionStore) RemoveAllSessions() error {
|
||||||
_, err := me.GetMaster().Exec("DELETE FROM Sessions")
|
_, err := me.GetMaster().Exec("DELETE FROM Sessions")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.RemoveAllSessions", "store.sql_session.remove_all_sessions_for_team.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return errors.Wrap(err, "failed to delete all Sessions")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) PermanentDeleteSessionsByUser(userId string) *model.AppError {
|
func (me SqlSessionStore) PermanentDeleteSessionsByUser(userId string) error {
|
||||||
_, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE UserId = :UserId", map[string]interface{}{"UserId": userId})
|
_, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE UserId = :UserId", map[string]interface{}{"UserId": userId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.RemoveAllSessionsForUser", "store.sql_session.permanent_delete_sessions_by_user.app_error", nil, "id="+userId+", err="+err.Error(), http.StatusInternalServerError)
|
return errors.Wrapf(err, "failed to delete Session with userId=%s", userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
|
func (me SqlSessionStore) UpdateExpiresAt(sessionId string, time int64) error {
|
||||||
_, err := me.GetMaster().Exec("UPDATE Sessions SET ExpiresAt = :ExpiresAt, ExpiredNotify = false WHERE Id = :Id", map[string]interface{}{"ExpiresAt": time, "Id": sessionId})
|
_, err := me.GetMaster().Exec("UPDATE Sessions SET ExpiresAt = :ExpiresAt, ExpiredNotify = false WHERE Id = :Id", map[string]interface{}{"ExpiresAt": time, "Id": sessionId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.UpdateExpiresAt", "store.sql_session.update_expires_at.app_error", nil, "sessionId="+sessionId, http.StatusInternalServerError)
|
return errors.Wrapf(err, "failed to update Session with sessionId=%s", sessionId)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) UpdateLastActivityAt(sessionId string, time int64) *model.AppError {
|
func (me SqlSessionStore) UpdateLastActivityAt(sessionId string, time int64) error {
|
||||||
_, err := me.GetMaster().Exec("UPDATE Sessions SET LastActivityAt = :LastActivityAt WHERE Id = :Id", map[string]interface{}{"LastActivityAt": time, "Id": sessionId})
|
_, err := me.GetMaster().Exec("UPDATE Sessions SET LastActivityAt = :LastActivityAt WHERE Id = :Id", map[string]interface{}{"LastActivityAt": time, "Id": sessionId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.UpdateLastActivityAt", "store.sql_session.update_last_activity.app_error", nil, "sessionId="+sessionId, http.StatusInternalServerError)
|
return errors.Wrapf(err, "failed to update Session with id=%s", sessionId)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) UpdateRoles(userId, roles string) (string, *model.AppError) {
|
func (me SqlSessionStore) UpdateRoles(userId, roles string) (string, error) {
|
||||||
query := "UPDATE Sessions SET Roles = :Roles WHERE UserId = :UserId"
|
query := "UPDATE Sessions SET Roles = :Roles WHERE UserId = :UserId"
|
||||||
|
|
||||||
_, err := me.GetMaster().Exec(query, map[string]interface{}{"Roles": roles, "UserId": userId})
|
_, err := me.GetMaster().Exec(query, map[string]interface{}{"Roles": roles, "UserId": userId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", model.NewAppError("SqlSessionStore.UpdateRoles", "store.sql_session.update_roles.app_error", nil, "userId="+userId, http.StatusInternalServerError)
|
return "", errors.Wrapf(err, "failed to update Session with userId=%s and roles=%s", userId, roles)
|
||||||
}
|
}
|
||||||
return userId, nil
|
return userId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, *model.AppError) {
|
func (me SqlSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error) {
|
||||||
query := "UPDATE Sessions SET DeviceId = :DeviceId, ExpiresAt = :ExpiresAt, ExpiredNotify = false WHERE Id = :Id"
|
query := "UPDATE Sessions SET DeviceId = :DeviceId, ExpiresAt = :ExpiresAt, ExpiredNotify = false WHERE Id = :Id"
|
||||||
|
|
||||||
_, err := me.GetMaster().Exec(query, map[string]interface{}{"DeviceId": deviceId, "Id": id, "ExpiresAt": expiresAt})
|
_, err := me.GetMaster().Exec(query, map[string]interface{}{"DeviceId": deviceId, "Id": id, "ExpiresAt": expiresAt})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", model.NewAppError("SqlSessionStore.UpdateDeviceId", "store.sql_session.update_device_id.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return "", errors.Wrapf(err, "failed to update Session with id=%s", id)
|
||||||
}
|
}
|
||||||
return deviceId, nil
|
return deviceId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
func (me SqlSessionStore) UpdateProps(session *model.Session) error {
|
||||||
oldSession, appErr := me.Get(session.Id)
|
oldSession, appErr := me.Get(session.Id)
|
||||||
if appErr != nil {
|
if appErr != nil {
|
||||||
return appErr
|
return appErr
|
||||||
@@ -252,15 +254,15 @@ func (me SqlSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
|||||||
|
|
||||||
count, err := me.GetMaster().Update(oldSession)
|
count, err := me.GetMaster().Update(oldSession)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return model.NewAppError("SqlSessionStore.UpdateProps", "store.sql_session.update_props.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return errors.Wrap(err, "failed to update Session")
|
||||||
}
|
}
|
||||||
if count != 1 {
|
if count != 1 {
|
||||||
return model.NewAppError("SqlSessionStore.UpdateProps", "store.sql_session.update_props.app_error", nil, "", http.StatusInternalServerError)
|
return fmt.Errorf("updated Sessions were %d, expected 1", count)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me SqlSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
func (me SqlSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||||
query :=
|
query :=
|
||||||
`SELECT
|
`SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
@@ -269,7 +271,7 @@ func (me SqlSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
|||||||
WHERE ExpiresAt > :Time`
|
WHERE ExpiresAt > :Time`
|
||||||
count, err := me.GetReplica().SelectInt(query, map[string]interface{}{"Time": model.GetMillis()})
|
count, err := me.GetReplica().SelectInt(query, map[string]interface{}{"Time": model.GetMillis()})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return int64(0), model.NewAppError("SqlSessionStore.AnalyticsSessionCount", "store.sql_session.analytics_session_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
return int64(0), errors.Wrap(err, "failed to count Sessions")
|
||||||
}
|
}
|
||||||
return count, nil
|
return count, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,21 +369,21 @@ type BotStore interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SessionStore interface {
|
type SessionStore interface {
|
||||||
Get(sessionIdOrToken string) (*model.Session, *model.AppError)
|
Get(sessionIdOrToken string) (*model.Session, error)
|
||||||
Save(session *model.Session) (*model.Session, *model.AppError)
|
Save(session *model.Session) (*model.Session, error)
|
||||||
GetSessions(userId string) ([]*model.Session, *model.AppError)
|
GetSessions(userId string) ([]*model.Session, error)
|
||||||
GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError)
|
GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error)
|
||||||
GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, *model.AppError)
|
GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error)
|
||||||
UpdateExpiredNotify(sessionid string, notified bool) *model.AppError
|
UpdateExpiredNotify(sessionid string, notified bool) error
|
||||||
Remove(sessionIdOrToken string) *model.AppError
|
Remove(sessionIdOrToken string) error
|
||||||
RemoveAllSessions() *model.AppError
|
RemoveAllSessions() error
|
||||||
PermanentDeleteSessionsByUser(teamId string) *model.AppError
|
PermanentDeleteSessionsByUser(teamId string) error
|
||||||
UpdateExpiresAt(sessionId string, time int64) *model.AppError
|
UpdateExpiresAt(sessionId string, time int64) error
|
||||||
UpdateLastActivityAt(sessionId string, time int64) *model.AppError
|
UpdateLastActivityAt(sessionId string, time int64) error
|
||||||
UpdateRoles(userId string, roles string) (string, *model.AppError)
|
UpdateRoles(userId string, roles string) (string, error)
|
||||||
UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, *model.AppError)
|
UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error)
|
||||||
UpdateProps(session *model.Session) *model.AppError
|
UpdateProps(session *model.Session) error
|
||||||
AnalyticsSessionCount() (int64, *model.AppError)
|
AnalyticsSessionCount() (int64, error)
|
||||||
Cleanup(expiryTime int64, batchSize int64)
|
Cleanup(expiryTime int64, batchSize int64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ type SessionStore struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AnalyticsSessionCount provides a mock function with given fields:
|
// AnalyticsSessionCount provides a mock function with given fields:
|
||||||
func (_m *SessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
func (_m *SessionStore) AnalyticsSessionCount() (int64, error) {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
||||||
var r0 int64
|
var r0 int64
|
||||||
@@ -25,13 +25,11 @@ func (_m *SessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
|||||||
r0 = ret.Get(0).(int64)
|
r0 = ret.Get(0).(int64)
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func() error); ok {
|
||||||
r1 = rf()
|
r1 = rf()
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
@@ -43,7 +41,7 @@ func (_m *SessionStore) Cleanup(expiryTime int64, batchSize int64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get provides a mock function with given fields: sessionIdOrToken
|
// Get provides a mock function with given fields: sessionIdOrToken
|
||||||
func (_m *SessionStore) Get(sessionIdOrToken string) (*model.Session, *model.AppError) {
|
func (_m *SessionStore) Get(sessionIdOrToken string) (*model.Session, error) {
|
||||||
ret := _m.Called(sessionIdOrToken)
|
ret := _m.Called(sessionIdOrToken)
|
||||||
|
|
||||||
var r0 *model.Session
|
var r0 *model.Session
|
||||||
@@ -55,20 +53,18 @@ func (_m *SessionStore) Get(sessionIdOrToken string) (*model.Session, *model.App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||||
r1 = rf(sessionIdOrToken)
|
r1 = rf(sessionIdOrToken)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSessions provides a mock function with given fields: userId
|
// GetSessions provides a mock function with given fields: userId
|
||||||
func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, *model.AppError) {
|
func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, error) {
|
||||||
ret := _m.Called(userId)
|
ret := _m.Called(userId)
|
||||||
|
|
||||||
var r0 []*model.Session
|
var r0 []*model.Session
|
||||||
@@ -80,20 +76,18 @@ func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, *model.App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||||
r1 = rf(userId)
|
r1 = rf(userId)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSessionsExpired provides a mock function with given fields: thresholdMillis, mobileOnly, unnotifiedOnly
|
// GetSessionsExpired provides a mock function with given fields: thresholdMillis, mobileOnly, unnotifiedOnly
|
||||||
func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, *model.AppError) {
|
func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) {
|
||||||
ret := _m.Called(thresholdMillis, mobileOnly, unnotifiedOnly)
|
ret := _m.Called(thresholdMillis, mobileOnly, unnotifiedOnly)
|
||||||
|
|
||||||
var r0 []*model.Session
|
var r0 []*model.Session
|
||||||
@@ -105,20 +99,18 @@ func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly boo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func(int64, bool, bool) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(int64, bool, bool) error); ok {
|
||||||
r1 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
|
r1 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSessionsWithActiveDeviceIds provides a mock function with given fields: userId
|
// GetSessionsWithActiveDeviceIds provides a mock function with given fields: userId
|
||||||
func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError) {
|
func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error) {
|
||||||
ret := _m.Called(userId)
|
ret := _m.Called(userId)
|
||||||
|
|
||||||
var r0 []*model.Session
|
var r0 []*model.Session
|
||||||
@@ -130,68 +122,60 @@ func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||||
r1 = rf(userId)
|
r1 = rf(userId)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// PermanentDeleteSessionsByUser provides a mock function with given fields: teamId
|
// PermanentDeleteSessionsByUser provides a mock function with given fields: teamId
|
||||||
func (_m *SessionStore) PermanentDeleteSessionsByUser(teamId string) *model.AppError {
|
func (_m *SessionStore) PermanentDeleteSessionsByUser(teamId string) error {
|
||||||
ret := _m.Called(teamId)
|
ret := _m.Called(teamId)
|
||||||
|
|
||||||
var r0 *model.AppError
|
var r0 error
|
||||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
||||||
r0 = rf(teamId)
|
r0 = rf(teamId)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
r0 = ret.Error(0)
|
||||||
r0 = ret.Get(0).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove provides a mock function with given fields: sessionIdOrToken
|
// Remove provides a mock function with given fields: sessionIdOrToken
|
||||||
func (_m *SessionStore) Remove(sessionIdOrToken string) *model.AppError {
|
func (_m *SessionStore) Remove(sessionIdOrToken string) error {
|
||||||
ret := _m.Called(sessionIdOrToken)
|
ret := _m.Called(sessionIdOrToken)
|
||||||
|
|
||||||
var r0 *model.AppError
|
var r0 error
|
||||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
||||||
r0 = rf(sessionIdOrToken)
|
r0 = rf(sessionIdOrToken)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
r0 = ret.Error(0)
|
||||||
r0 = ret.Get(0).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveAllSessions provides a mock function with given fields:
|
// RemoveAllSessions provides a mock function with given fields:
|
||||||
func (_m *SessionStore) RemoveAllSessions() *model.AppError {
|
func (_m *SessionStore) RemoveAllSessions() error {
|
||||||
ret := _m.Called()
|
ret := _m.Called()
|
||||||
|
|
||||||
var r0 *model.AppError
|
var r0 error
|
||||||
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
|
if rf, ok := ret.Get(0).(func() error); ok {
|
||||||
r0 = rf()
|
r0 = rf()
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
r0 = ret.Error(0)
|
||||||
r0 = ret.Get(0).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save provides a mock function with given fields: session
|
// Save provides a mock function with given fields: session
|
||||||
func (_m *SessionStore) Save(session *model.Session) (*model.Session, *model.AppError) {
|
func (_m *SessionStore) Save(session *model.Session) (*model.Session, error) {
|
||||||
ret := _m.Called(session)
|
ret := _m.Called(session)
|
||||||
|
|
||||||
var r0 *model.Session
|
var r0 *model.Session
|
||||||
@@ -203,20 +187,18 @@ func (_m *SessionStore) Save(session *model.Session) (*model.Session, *model.App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func(*model.Session) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(*model.Session) error); ok {
|
||||||
r1 = rf(session)
|
r1 = rf(session)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateDeviceId provides a mock function with given fields: id, deviceId, expiresAt
|
// UpdateDeviceId provides a mock function with given fields: id, deviceId, expiresAt
|
||||||
func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, *model.AppError) {
|
func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error) {
|
||||||
ret := _m.Called(id, deviceId, expiresAt)
|
ret := _m.Called(id, deviceId, expiresAt)
|
||||||
|
|
||||||
var r0 string
|
var r0 string
|
||||||
@@ -226,84 +208,74 @@ func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int
|
|||||||
r0 = ret.Get(0).(string)
|
r0 = ret.Get(0).(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func(string, string, int64) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(string, string, int64) error); ok {
|
||||||
r1 = rf(id, deviceId, expiresAt)
|
r1 = rf(id, deviceId, expiresAt)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateExpiredNotify provides a mock function with given fields: sessionid, notified
|
// UpdateExpiredNotify provides a mock function with given fields: sessionid, notified
|
||||||
func (_m *SessionStore) UpdateExpiredNotify(sessionid string, notified bool) *model.AppError {
|
func (_m *SessionStore) UpdateExpiredNotify(sessionid string, notified bool) error {
|
||||||
ret := _m.Called(sessionid, notified)
|
ret := _m.Called(sessionid, notified)
|
||||||
|
|
||||||
var r0 *model.AppError
|
var r0 error
|
||||||
if rf, ok := ret.Get(0).(func(string, bool) *model.AppError); ok {
|
if rf, ok := ret.Get(0).(func(string, bool) error); ok {
|
||||||
r0 = rf(sessionid, notified)
|
r0 = rf(sessionid, notified)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
r0 = ret.Error(0)
|
||||||
r0 = ret.Get(0).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateExpiresAt provides a mock function with given fields: sessionId, time
|
// UpdateExpiresAt provides a mock function with given fields: sessionId, time
|
||||||
func (_m *SessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
|
func (_m *SessionStore) UpdateExpiresAt(sessionId string, time int64) error {
|
||||||
ret := _m.Called(sessionId, time)
|
ret := _m.Called(sessionId, time)
|
||||||
|
|
||||||
var r0 *model.AppError
|
var r0 error
|
||||||
if rf, ok := ret.Get(0).(func(string, int64) *model.AppError); ok {
|
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
|
||||||
r0 = rf(sessionId, time)
|
r0 = rf(sessionId, time)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
r0 = ret.Error(0)
|
||||||
r0 = ret.Get(0).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateLastActivityAt provides a mock function with given fields: sessionId, time
|
// UpdateLastActivityAt provides a mock function with given fields: sessionId, time
|
||||||
func (_m *SessionStore) UpdateLastActivityAt(sessionId string, time int64) *model.AppError {
|
func (_m *SessionStore) UpdateLastActivityAt(sessionId string, time int64) error {
|
||||||
ret := _m.Called(sessionId, time)
|
ret := _m.Called(sessionId, time)
|
||||||
|
|
||||||
var r0 *model.AppError
|
var r0 error
|
||||||
if rf, ok := ret.Get(0).(func(string, int64) *model.AppError); ok {
|
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
|
||||||
r0 = rf(sessionId, time)
|
r0 = rf(sessionId, time)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
r0 = ret.Error(0)
|
||||||
r0 = ret.Get(0).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateProps provides a mock function with given fields: session
|
// UpdateProps provides a mock function with given fields: session
|
||||||
func (_m *SessionStore) UpdateProps(session *model.Session) *model.AppError {
|
func (_m *SessionStore) UpdateProps(session *model.Session) error {
|
||||||
ret := _m.Called(session)
|
ret := _m.Called(session)
|
||||||
|
|
||||||
var r0 *model.AppError
|
var r0 error
|
||||||
if rf, ok := ret.Get(0).(func(*model.Session) *model.AppError); ok {
|
if rf, ok := ret.Get(0).(func(*model.Session) error); ok {
|
||||||
r0 = rf(session)
|
r0 = rf(session)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
r0 = ret.Error(0)
|
||||||
r0 = ret.Get(0).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0
|
return r0
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateRoles provides a mock function with given fields: userId, roles
|
// UpdateRoles provides a mock function with given fields: userId, roles
|
||||||
func (_m *SessionStore) UpdateRoles(userId string, roles string) (string, *model.AppError) {
|
func (_m *SessionStore) UpdateRoles(userId string, roles string) (string, error) {
|
||||||
ret := _m.Called(userId, roles)
|
ret := _m.Called(userId, roles)
|
||||||
|
|
||||||
var r0 string
|
var r0 string
|
||||||
@@ -313,13 +285,11 @@ func (_m *SessionStore) UpdateRoles(userId string, roles string) (string, *model
|
|||||||
r0 = ret.Get(0).(string)
|
r0 = ret.Get(0).(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 error
|
||||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
||||||
r1 = rf(userId, roles)
|
r1 = rf(userId, roles)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
r1 = ret.Error(1)
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r0, r1
|
return r0, r1
|
||||||
|
|||||||
@@ -366,8 +366,8 @@ func testOAuthStoreDeleteApp(t *testing.T, ss store.Store) {
|
|||||||
s1.Token = model.NewId()
|
s1.Token = model.NewId()
|
||||||
s1.IsOAuth = true
|
s1.IsOAuth = true
|
||||||
|
|
||||||
s1, err = ss.Session().Save(s1)
|
s1, nErr := ss.Session().Save(s1)
|
||||||
require.Nil(t, err)
|
require.Nil(t, nErr)
|
||||||
|
|
||||||
ad1 := model.AccessData{}
|
ad1 := model.AccessData{}
|
||||||
ad1.ClientId = a1.Id
|
ad1.ClientId = a1.Id
|
||||||
@@ -382,8 +382,8 @@ func testOAuthStoreDeleteApp(t *testing.T, ss store.Store) {
|
|||||||
err = ss.OAuth().DeleteApp(a1.Id)
|
err = ss.OAuth().DeleteApp(a1.Id)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|
||||||
_, err = ss.Session().Get(s1.Token)
|
_, nErr = ss.Session().Get(s1.Token)
|
||||||
require.NotNil(t, err, "should error - session should be deleted")
|
require.NotNil(t, nErr, "should error - session should be deleted")
|
||||||
|
|
||||||
_, err = ss.OAuth().GetAccessData(s1.Token)
|
_, err = ss.OAuth().GetAccessData(s1.Token)
|
||||||
require.NotNil(t, err, "should error - access data should be deleted")
|
require.NotNil(t, err, "should error - access data should be deleted")
|
||||||
|
|||||||
@@ -381,12 +381,14 @@ func testUpdateExpiredNotify(t *testing.T, ss store.Store) {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
require.False(t, session.ExpiredNotify)
|
require.False(t, session.ExpiredNotify)
|
||||||
|
|
||||||
ss.Session().UpdateExpiredNotify(session.Id, true)
|
err = ss.Session().UpdateExpiredNotify(session.Id, true)
|
||||||
|
require.Nil(t, err)
|
||||||
session, err = ss.Session().Get(s1.Id)
|
session, err = ss.Session().Get(s1.Id)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
require.True(t, session.ExpiredNotify)
|
require.True(t, session.ExpiredNotify)
|
||||||
|
|
||||||
ss.Session().UpdateExpiredNotify(session.Id, false)
|
err = ss.Session().UpdateExpiredNotify(session.Id, false)
|
||||||
|
require.Nil(t, err)
|
||||||
session, err = ss.Session().Get(s1.Id)
|
session, err = ss.Session().Get(s1.Id)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
require.False(t, session.ExpiredNotify)
|
require.False(t, session.ExpiredNotify)
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ func testUserAccessTokenSearch(t *testing.T, ss store.Store) {
|
|||||||
s1.UserId = uat.UserId
|
s1.UserId = uat.UserId
|
||||||
s1.Token = uat.Token
|
s1.Token = uat.Token
|
||||||
|
|
||||||
s1, err = ss.Session().Save(s1)
|
s1, nErr := ss.Session().Save(s1)
|
||||||
require.Nil(t, err)
|
require.Nil(t, nErr)
|
||||||
|
|
||||||
_, err = ss.UserAccessToken().Save(uat)
|
_, err = ss.UserAccessToken().Save(uat)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|||||||
@@ -5388,7 +5388,7 @@ func (s *TimerLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.AnalyticsSessionCount()
|
resultVar0, resultVar1 := s.SessionStore.AnalyticsSessionCount()
|
||||||
@@ -5419,7 +5419,7 @@ func (s *TimerLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) Get(sessionIdOrToken string) (*model.Session, *model.AppError) {
|
func (s *TimerLayerSessionStore) Get(sessionIdOrToken string) (*model.Session, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.Get(sessionIdOrToken)
|
resultVar0, resultVar1 := s.SessionStore.Get(sessionIdOrToken)
|
||||||
@@ -5435,7 +5435,7 @@ func (s *TimerLayerSessionStore) Get(sessionIdOrToken string) (*model.Session, *
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) GetSessions(userId string) ([]*model.Session, *model.AppError) {
|
func (s *TimerLayerSessionStore) GetSessions(userId string) ([]*model.Session, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.GetSessions(userId)
|
resultVar0, resultVar1 := s.SessionStore.GetSessions(userId)
|
||||||
@@ -5451,7 +5451,7 @@ func (s *TimerLayerSessionStore) GetSessions(userId string) ([]*model.Session, *
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, *model.AppError) {
|
func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.GetSessionsExpired(thresholdMillis, mobileOnly, unnotifiedOnly)
|
resultVar0, resultVar1 := s.SessionStore.GetSessionsExpired(thresholdMillis, mobileOnly, unnotifiedOnly)
|
||||||
@@ -5467,7 +5467,7 @@ func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobil
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError) {
|
func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.GetSessionsWithActiveDeviceIds(userId)
|
resultVar0, resultVar1 := s.SessionStore.GetSessionsWithActiveDeviceIds(userId)
|
||||||
@@ -5483,7 +5483,7 @@ func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userId string) (
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) *model.AppError {
|
func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) error {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0 := s.SessionStore.PermanentDeleteSessionsByUser(teamId)
|
resultVar0 := s.SessionStore.PermanentDeleteSessionsByUser(teamId)
|
||||||
@@ -5499,7 +5499,7 @@ func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) *m
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) Remove(sessionIdOrToken string) *model.AppError {
|
func (s *TimerLayerSessionStore) Remove(sessionIdOrToken string) error {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0 := s.SessionStore.Remove(sessionIdOrToken)
|
resultVar0 := s.SessionStore.Remove(sessionIdOrToken)
|
||||||
@@ -5515,7 +5515,7 @@ func (s *TimerLayerSessionStore) Remove(sessionIdOrToken string) *model.AppError
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) RemoveAllSessions() *model.AppError {
|
func (s *TimerLayerSessionStore) RemoveAllSessions() error {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0 := s.SessionStore.RemoveAllSessions()
|
resultVar0 := s.SessionStore.RemoveAllSessions()
|
||||||
@@ -5531,7 +5531,7 @@ func (s *TimerLayerSessionStore) RemoveAllSessions() *model.AppError {
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) Save(session *model.Session) (*model.Session, *model.AppError) {
|
func (s *TimerLayerSessionStore) Save(session *model.Session) (*model.Session, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.Save(session)
|
resultVar0, resultVar1 := s.SessionStore.Save(session)
|
||||||
@@ -5547,7 +5547,7 @@ func (s *TimerLayerSessionStore) Save(session *model.Session) (*model.Session, *
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, *model.AppError) {
|
func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.UpdateDeviceId(id, deviceId, expiresAt)
|
resultVar0, resultVar1 := s.SessionStore.UpdateDeviceId(id, deviceId, expiresAt)
|
||||||
@@ -5563,7 +5563,7 @@ func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceId string, expi
|
|||||||
return resultVar0, resultVar1
|
return resultVar0, resultVar1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) *model.AppError {
|
func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) error {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0 := s.SessionStore.UpdateExpiredNotify(sessionid, notified)
|
resultVar0 := s.SessionStore.UpdateExpiredNotify(sessionid, notified)
|
||||||
@@ -5579,7 +5579,7 @@ func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
|
func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) error {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0 := s.SessionStore.UpdateExpiresAt(sessionId, time)
|
resultVar0 := s.SessionStore.UpdateExpiresAt(sessionId, time)
|
||||||
@@ -5595,7 +5595,7 @@ func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) *
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionId string, time int64) *model.AppError {
|
func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionId string, time int64) error {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0 := s.SessionStore.UpdateLastActivityAt(sessionId, time)
|
resultVar0 := s.SessionStore.UpdateLastActivityAt(sessionId, time)
|
||||||
@@ -5611,7 +5611,7 @@ func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionId string, time int
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) error {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0 := s.SessionStore.UpdateProps(session)
|
resultVar0 := s.SessionStore.UpdateProps(session)
|
||||||
@@ -5627,7 +5627,7 @@ func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) *model.AppE
|
|||||||
return resultVar0
|
return resultVar0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TimerLayerSessionStore) UpdateRoles(userId string, roles string) (string, *model.AppError) {
|
func (s *TimerLayerSessionStore) UpdateRoles(userId string, roles string) (string, error) {
|
||||||
start := timemodule.Now()
|
start := timemodule.Now()
|
||||||
|
|
||||||
resultVar0, resultVar1 := s.SessionStore.UpdateRoles(userId, roles)
|
resultVar0, resultVar1 := s.SessionStore.UpdateRoles(userId, roles)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user