коммит произвёл
GitHub
родитель
b15c0484c6
Коммит
87dfbc13c0
@@ -5958,7 +5958,7 @@ func (s *OpenTracingLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme,
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.AnalyticsSessionCount")
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Get")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6007,7 +6007,7 @@ func (s *OpenTracingLayerSessionStore) Get(sessionIdOrToken string) (*model.Sess
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessions")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6025,7 +6025,7 @@ func (s *OpenTracingLayerSessionStore) GetSessions(userId string) ([]*model.Sess
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessionsExpired")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6043,7 +6043,7 @@ func (s *OpenTracingLayerSessionStore) GetSessionsExpired(thresholdMillis int64,
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.GetSessionsWithActiveDeviceIds")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6061,7 +6061,7 @@ func (s *OpenTracingLayerSessionStore) GetSessionsWithActiveDeviceIds(userId str
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) *model.AppError {
|
||||
func (s *OpenTracingLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.PermanentDeleteSessionsByUser")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6079,7 +6079,7 @@ func (s *OpenTracingLayerSessionStore) PermanentDeleteSessionsByUser(teamId stri
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerSessionStore) Remove(sessionIdOrToken string) *model.AppError {
|
||||
func (s *OpenTracingLayerSessionStore) Remove(sessionIdOrToken string) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Remove")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6097,7 +6097,7 @@ func (s *OpenTracingLayerSessionStore) Remove(sessionIdOrToken string) *model.Ap
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerSessionStore) RemoveAllSessions() *model.AppError {
|
||||
func (s *OpenTracingLayerSessionStore) RemoveAllSessions() error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.RemoveAllSessions")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6115,7 +6115,7 @@ func (s *OpenTracingLayerSessionStore) RemoveAllSessions() *model.AppError {
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.Save")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6133,7 +6133,7 @@ func (s *OpenTracingLayerSessionStore) Save(session *model.Session) (*model.Sess
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateDeviceId")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6151,7 +6151,7 @@ func (s *OpenTracingLayerSessionStore) UpdateDeviceId(id string, deviceId string
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateExpiredNotify")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6169,7 +6169,7 @@ func (s *OpenTracingLayerSessionStore) UpdateExpiredNotify(sessionid string, not
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateExpiresAt")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6187,7 +6187,7 @@ func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionId string, time in
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateLastActivityAt")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6205,7 +6205,7 @@ func (s *OpenTracingLayerSessionStore) UpdateLastActivityAt(sessionId string, ti
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
||||
func (s *OpenTracingLayerSessionStore) UpdateProps(session *model.Session) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateProps")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -6223,7 +6223,7 @@ func (s *OpenTracingLayerSessionStore) UpdateProps(session *model.Session) *mode
|
||||
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()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateRoles")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
package sqlstore
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/store"
|
||||
@@ -45,19 +47,19 @@ func (me SqlSessionStore) createIndexesIfNotExists() {
|
||||
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 {
|
||||
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()
|
||||
|
||||
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)
|
||||
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))
|
||||
@@ -70,19 +72,19 @@ func (me SqlSessionStore) Save(session *model.Session) (*model.Session, *model.A
|
||||
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
|
||||
|
||||
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 {
|
||||
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]
|
||||
|
||||
tempMembers, err := me.Team().GetTeamsForUser(sessions[0].UserId)
|
||||
tempMembers, err := me.Team().GetTeamsForUser(session.UserId)
|
||||
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))
|
||||
for _, tm := range tempMembers {
|
||||
@@ -93,16 +95,16 @@ func (me SqlSessionStore) Get(sessionIdOrToken string) (*model.Session, *model.A
|
||||
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
|
||||
|
||||
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)
|
||||
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 {
|
||||
@@ -116,7 +118,7 @@ func (me SqlSessionStore) GetSessions(userId string) ([]*model.Session, *model.A
|
||||
return sessions, nil
|
||||
}
|
||||
|
||||
func (me SqlSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError) {
|
||||
func (me SqlSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error) {
|
||||
query :=
|
||||
`SELECT *
|
||||
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()})
|
||||
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
|
||||
}
|
||||
|
||||
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()
|
||||
builder := me.getQueryBuilder().
|
||||
Select("*").
|
||||
@@ -153,97 +155,97 @@ func (me SqlSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly b
|
||||
|
||||
query, args, err := builder.ToSql()
|
||||
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
|
||||
|
||||
_, err = me.GetReplica().Select(&sessions, query, args...)
|
||||
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
|
||||
}
|
||||
|
||||
func (me SqlSessionStore) UpdateExpiredNotify(sessionId string, notified bool) *model.AppError {
|
||||
func (me SqlSessionStore) UpdateExpiredNotify(sessionId string, notified bool) error {
|
||||
query, args, err := me.getQueryBuilder().
|
||||
Update("Sessions").
|
||||
Set("ExpiredNotify", notified).
|
||||
Where(sq.Eq{"Id": sessionId}).
|
||||
ToSql()
|
||||
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...)
|
||||
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
|
||||
}
|
||||
|
||||
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})
|
||||
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
|
||||
}
|
||||
|
||||
func (me SqlSessionStore) RemoveAllSessions() *model.AppError {
|
||||
func (me SqlSessionStore) RemoveAllSessions() error {
|
||||
_, err := me.GetMaster().Exec("DELETE FROM Sessions")
|
||||
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
|
||||
}
|
||||
|
||||
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})
|
||||
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
|
||||
}
|
||||
|
||||
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})
|
||||
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
|
||||
}
|
||||
|
||||
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})
|
||||
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
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
_, err := me.GetMaster().Exec(query, map[string]interface{}{"Roles": roles, "UserId": userId})
|
||||
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
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
_, err := me.GetMaster().Exec(query, map[string]interface{}{"DeviceId": deviceId, "Id": id, "ExpiresAt": expiresAt})
|
||||
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
|
||||
}
|
||||
|
||||
func (me SqlSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
||||
func (me SqlSessionStore) UpdateProps(session *model.Session) error {
|
||||
oldSession, appErr := me.Get(session.Id)
|
||||
if appErr != nil {
|
||||
return appErr
|
||||
@@ -252,15 +254,15 @@ func (me SqlSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
||||
|
||||
count, err := me.GetMaster().Update(oldSession)
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
func (me SqlSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
||||
func (me SqlSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||
query :=
|
||||
`SELECT
|
||||
COUNT(*)
|
||||
@@ -269,7 +271,7 @@ func (me SqlSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
||||
WHERE ExpiresAt > :Time`
|
||||
count, err := me.GetReplica().SelectInt(query, map[string]interface{}{"Time": model.GetMillis()})
|
||||
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
|
||||
}
|
||||
|
||||
@@ -369,21 +369,21 @@ type BotStore interface {
|
||||
}
|
||||
|
||||
type SessionStore interface {
|
||||
Get(sessionIdOrToken string) (*model.Session, *model.AppError)
|
||||
Save(session *model.Session) (*model.Session, *model.AppError)
|
||||
GetSessions(userId string) ([]*model.Session, *model.AppError)
|
||||
GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError)
|
||||
GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, *model.AppError)
|
||||
UpdateExpiredNotify(sessionid string, notified bool) *model.AppError
|
||||
Remove(sessionIdOrToken string) *model.AppError
|
||||
RemoveAllSessions() *model.AppError
|
||||
PermanentDeleteSessionsByUser(teamId string) *model.AppError
|
||||
UpdateExpiresAt(sessionId string, time int64) *model.AppError
|
||||
UpdateLastActivityAt(sessionId string, time int64) *model.AppError
|
||||
UpdateRoles(userId string, roles string) (string, *model.AppError)
|
||||
UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, *model.AppError)
|
||||
UpdateProps(session *model.Session) *model.AppError
|
||||
AnalyticsSessionCount() (int64, *model.AppError)
|
||||
Get(sessionIdOrToken string) (*model.Session, error)
|
||||
Save(session *model.Session) (*model.Session, error)
|
||||
GetSessions(userId string) ([]*model.Session, error)
|
||||
GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error)
|
||||
GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error)
|
||||
UpdateExpiredNotify(sessionid string, notified bool) error
|
||||
Remove(sessionIdOrToken string) error
|
||||
RemoveAllSessions() error
|
||||
PermanentDeleteSessionsByUser(teamId string) error
|
||||
UpdateExpiresAt(sessionId string, time int64) error
|
||||
UpdateLastActivityAt(sessionId string, time int64) error
|
||||
UpdateRoles(userId string, roles string) (string, error)
|
||||
UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error)
|
||||
UpdateProps(session *model.Session) error
|
||||
AnalyticsSessionCount() (int64, error)
|
||||
Cleanup(expiryTime int64, batchSize int64)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type SessionStore struct {
|
||||
}
|
||||
|
||||
// AnalyticsSessionCount provides a mock function with given fields:
|
||||
func (_m *SessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
||||
func (_m *SessionStore) AnalyticsSessionCount() (int64, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 int64
|
||||
@@ -25,13 +25,11 @@ func (_m *SessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
||||
r0 = ret.Get(0).(int64)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -43,7 +41,7 @@ func (_m *SessionStore) Cleanup(expiryTime int64, batchSize int64) {
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.Session
|
||||
@@ -55,20 +53,18 @@ func (_m *SessionStore) Get(sessionIdOrToken string) (*model.Session, *model.App
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(sessionIdOrToken)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 []*model.Session
|
||||
@@ -80,20 +76,18 @@ func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, *model.App
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(userId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 []*model.Session
|
||||
@@ -105,20 +99,18 @@ func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly boo
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(int64, bool, bool) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(int64, bool, bool) error); ok {
|
||||
r1 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 []*model.Session
|
||||
@@ -130,68 +122,60 @@ func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(userId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string) error); ok {
|
||||
r0 = rf(teamId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string) error); ok {
|
||||
r0 = rf(sessionIdOrToken)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// RemoveAllSessions provides a mock function with given fields:
|
||||
func (_m *SessionStore) RemoveAllSessions() *model.AppError {
|
||||
func (_m *SessionStore) RemoveAllSessions() error {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func() error); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.Session
|
||||
@@ -203,20 +187,18 @@ func (_m *SessionStore) Save(session *model.Session) (*model.Session, *model.App
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(*model.Session) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(*model.Session) error); ok {
|
||||
r1 = rf(session)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 string
|
||||
@@ -226,84 +208,74 @@ func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string, int64) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, string, int64) error); ok {
|
||||
r1 = rf(id, deviceId, expiresAt)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, bool) *model.AppError); ok {
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string, bool) error); ok {
|
||||
r0 = rf(sessionid, notified)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, int64) *model.AppError); ok {
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
|
||||
r0 = rf(sessionId, time)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, int64) *model.AppError); ok {
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
|
||||
r0 = rf(sessionId, time)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Session) *model.AppError); ok {
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*model.Session) error); ok {
|
||||
r0 = rf(session)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var r0 string
|
||||
@@ -313,13 +285,11 @@ func (_m *SessionStore) UpdateRoles(userId string, roles string) (string, *model
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
||||
r1 = rf(userId, roles)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
|
||||
@@ -366,8 +366,8 @@ func testOAuthStoreDeleteApp(t *testing.T, ss store.Store) {
|
||||
s1.Token = model.NewId()
|
||||
s1.IsOAuth = true
|
||||
|
||||
s1, err = ss.Session().Save(s1)
|
||||
require.Nil(t, err)
|
||||
s1, nErr := ss.Session().Save(s1)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
ad1 := model.AccessData{}
|
||||
ad1.ClientId = a1.Id
|
||||
@@ -382,8 +382,8 @@ func testOAuthStoreDeleteApp(t *testing.T, ss store.Store) {
|
||||
err = ss.OAuth().DeleteApp(a1.Id)
|
||||
require.Nil(t, err)
|
||||
|
||||
_, err = ss.Session().Get(s1.Token)
|
||||
require.NotNil(t, err, "should error - session should be deleted")
|
||||
_, nErr = ss.Session().Get(s1.Token)
|
||||
require.NotNil(t, nErr, "should error - session should be deleted")
|
||||
|
||||
_, err = ss.OAuth().GetAccessData(s1.Token)
|
||||
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.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)
|
||||
require.Nil(t, err)
|
||||
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)
|
||||
require.Nil(t, err)
|
||||
require.False(t, session.ExpiredNotify)
|
||||
|
||||
@@ -134,8 +134,8 @@ func testUserAccessTokenSearch(t *testing.T, ss store.Store) {
|
||||
s1.UserId = uat.UserId
|
||||
s1.Token = uat.Token
|
||||
|
||||
s1, err = ss.Session().Save(s1)
|
||||
require.Nil(t, err)
|
||||
s1, nErr := ss.Session().Save(s1)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
_, err = ss.UserAccessToken().Save(uat)
|
||||
require.Nil(t, err)
|
||||
|
||||
@@ -5388,7 +5388,7 @@ func (s *TimerLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
|
||||
func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
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()
|
||||
|
||||
resultVar0, resultVar1 := s.SessionStore.Get(sessionIdOrToken)
|
||||
@@ -5435,7 +5435,7 @@ func (s *TimerLayerSessionStore) Get(sessionIdOrToken string) (*model.Session, *
|
||||
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()
|
||||
|
||||
resultVar0, resultVar1 := s.SessionStore.GetSessions(userId)
|
||||
@@ -5451,7 +5451,7 @@ func (s *TimerLayerSessionStore) GetSessions(userId string) ([]*model.Session, *
|
||||
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()
|
||||
|
||||
resultVar0, resultVar1 := s.SessionStore.GetSessionsExpired(thresholdMillis, mobileOnly, unnotifiedOnly)
|
||||
@@ -5467,7 +5467,7 @@ func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobil
|
||||
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()
|
||||
|
||||
resultVar0, resultVar1 := s.SessionStore.GetSessionsWithActiveDeviceIds(userId)
|
||||
@@ -5483,7 +5483,7 @@ func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userId string) (
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) *model.AppError {
|
||||
func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
resultVar0 := s.SessionStore.PermanentDeleteSessionsByUser(teamId)
|
||||
@@ -5499,7 +5499,7 @@ func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamId string) *m
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) Remove(sessionIdOrToken string) *model.AppError {
|
||||
func (s *TimerLayerSessionStore) Remove(sessionIdOrToken string) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
resultVar0 := s.SessionStore.Remove(sessionIdOrToken)
|
||||
@@ -5515,7 +5515,7 @@ func (s *TimerLayerSessionStore) Remove(sessionIdOrToken string) *model.AppError
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) RemoveAllSessions() *model.AppError {
|
||||
func (s *TimerLayerSessionStore) RemoveAllSessions() error {
|
||||
start := timemodule.Now()
|
||||
|
||||
resultVar0 := s.SessionStore.RemoveAllSessions()
|
||||
@@ -5531,7 +5531,7 @@ func (s *TimerLayerSessionStore) RemoveAllSessions() *model.AppError {
|
||||
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()
|
||||
|
||||
resultVar0, resultVar1 := s.SessionStore.Save(session)
|
||||
@@ -5547,7 +5547,7 @@ func (s *TimerLayerSessionStore) Save(session *model.Session) (*model.Session, *
|
||||
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()
|
||||
|
||||
resultVar0, resultVar1 := s.SessionStore.UpdateDeviceId(id, deviceId, expiresAt)
|
||||
@@ -5563,7 +5563,7 @@ func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceId string, expi
|
||||
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()
|
||||
|
||||
resultVar0 := s.SessionStore.UpdateExpiredNotify(sessionid, notified)
|
||||
@@ -5579,7 +5579,7 @@ func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
|
||||
func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
resultVar0 := s.SessionStore.UpdateExpiresAt(sessionId, time)
|
||||
@@ -5595,7 +5595,7 @@ func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) *
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionId string, time int64) *model.AppError {
|
||||
func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionId string, time int64) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
resultVar0 := s.SessionStore.UpdateLastActivityAt(sessionId, time)
|
||||
@@ -5611,7 +5611,7 @@ func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionId string, time int
|
||||
return resultVar0
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) *model.AppError {
|
||||
func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
resultVar0 := s.SessionStore.UpdateProps(session)
|
||||
@@ -5627,7 +5627,7 @@ func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) *model.AppE
|
||||
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()
|
||||
|
||||
resultVar0, resultVar1 := s.SessionStore.UpdateRoles(userId, roles)
|
||||
|
||||
Ссылка в новой задаче
Block a user