Automatic Merge
Этот коммит содержится в:
SimonSimonB
2021-02-05 11:22:27 +01:00
коммит произвёл GitHub
родитель 4a8496ef7c
Коммит ffebfbf56f
55 изменённых файлов: 1885 добавлений и 1885 удалений

Просмотреть файл

@@ -144,9 +144,9 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
return session, nil
}
func (a *App) GetSessions(userId string) ([]*model.Session, *model.AppError) {
func (a *App) GetSessions(userID string) ([]*model.Session, *model.AppError) {
sessions, err := 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)
}
@@ -154,10 +154,10 @@ func (a *App) GetSessions(userId string) ([]*model.Session, *model.AppError) {
return sessions, nil
}
func (a *App) UpdateSessionsIsGuest(userId string, isGuest bool) {
sessions, err := a.Srv().Store.Session().GetSessions(userId)
func (a *App) UpdateSessionsIsGuest(userID string, isGuest bool) {
sessions, err := a.Srv().Store.Session().GetSessions(userID)
if err != nil {
mlog.Error("Unable to get user sessions", mlog.String("user_id", userId), mlog.Err(err))
mlog.Error("Unable to get user sessions", mlog.String("user_id", userID), mlog.Err(err))
return
}
@@ -172,8 +172,8 @@ func (a *App) UpdateSessionsIsGuest(userId string, isGuest bool) {
}
}
func (a *App) RevokeAllSessions(userId string) *model.AppError {
sessions, err := a.Srv().Store.Session().GetSessions(userId)
func (a *App) RevokeAllSessions(userID string) *model.AppError {
sessions, err := a.Srv().Store.Session().GetSessions(userID)
if err != nil {
return model.NewAppError("RevokeAllSessions", "app.session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -187,7 +187,7 @@ func (a *App) RevokeAllSessions(userId string) *model.AppError {
}
}
a.ClearSessionCacheForUser(userId)
a.ClearSessionCacheForUser(userID)
return nil
}
@@ -209,14 +209,14 @@ func (a *App) RevokeSessionsFromAllUsers() *model.AppError {
return nil
}
func (a *App) ClearSessionCacheForUser(userId string) {
a.ClearSessionCacheForUserSkipClusterSend(userId)
func (a *App) ClearSessionCacheForUser(userID string) {
a.ClearSessionCacheForUserSkipClusterSend(userID)
if a.Cluster() != nil {
msg := &model.ClusterMessage{
Event: model.CLUSTER_EVENT_CLEAR_SESSION_CACHE_FOR_USER,
SendType: model.CLUSTER_SEND_RELIABLE,
Data: userId,
Data: userID,
}
a.Cluster().SendClusterMessage(msg)
}
@@ -234,12 +234,12 @@ func (a *App) ClearSessionCacheForAllUsers() {
}
}
func (a *App) ClearSessionCacheForUserSkipClusterSend(userId string) {
func (a *App) ClearSessionCacheForUserSkipClusterSend(userID string) {
if keys, err := a.Srv().sessionCache.Keys(); err == nil {
var session *model.Session
for _, key := range keys {
if err := a.Srv().sessionCache.Get(key, &session); err == nil {
if session.UserId == userId {
if session.UserId == userID {
a.Srv().sessionCache.Remove(key)
if a.Metrics() != nil {
a.Metrics().IncrementMemCacheInvalidationCounterSession()
@@ -249,7 +249,7 @@ func (a *App) ClearSessionCacheForUserSkipClusterSend(userId string) {
}
}
a.InvalidateWebConnSessionCacheForUser(userId)
a.InvalidateWebConnSessionCacheForUser(userID)
}
func (a *App) ClearSessionCacheForAllUsersSkipClusterSend() {
@@ -268,14 +268,14 @@ func (a *App) SessionCacheLength() int {
return 0
}
func (a *App) RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId string) *model.AppError {
sessions, err := a.Srv().Store.Session().GetSessions(userId)
func (a *App) RevokeSessionsForDeviceId(userID string, deviceId string, currentSessionId string) *model.AppError {
sessions, err := a.Srv().Store.Session().GetSessions(userID)
if err != nil {
return model.NewAppError("RevokeSessionsForDeviceId", "app.session.get_sessions.app_error", nil, err.Error(), http.StatusInternalServerError)
}
for _, session := range sessions {
if session.DeviceId == deviceId && session.Id != currentSessionId {
mlog.Debug("Revoking sessionId for userId. Re-login with the same device Id", mlog.String("session_id", session.Id), mlog.String("user_id", userId))
mlog.Debug("Revoking sessionId for userId. Re-login with the same device Id", mlog.String("session_id", session.Id), mlog.String("user_id", userID))
if err := a.RevokeSession(session); err != nil {
mlog.Warn("Could not revoke session for device", mlog.String("device_id", deviceId), mlog.Err(err))
}
@@ -590,8 +590,8 @@ func (a *App) GetUserAccessTokens(page, perPage int) ([]*model.UserAccessToken,
return tokens, nil
}
func (a *App) GetUserAccessTokensForUser(userId string, page, perPage int) ([]*model.UserAccessToken, *model.AppError) {
tokens, err := a.Srv().Store.UserAccessToken().GetByUser(userId, page*perPage, perPage)
func (a *App) GetUserAccessTokensForUser(userID string, page, perPage int) ([]*model.UserAccessToken, *model.AppError) {
tokens, err := a.Srv().Store.UserAccessToken().GetByUser(userID, page*perPage, perPage)
if err != nil {
return nil, model.NewAppError("GetUserAccessTokensForUser", "app.user_access_token.get_by_user.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -603,8 +603,8 @@ func (a *App) GetUserAccessTokensForUser(userId string, page, perPage int) ([]*m
}
func (a *App) GetUserAccessToken(tokenId string, sanitize bool) (*model.UserAccessToken, *model.AppError) {
token, err := a.Srv().Store.UserAccessToken().Get(tokenId)
func (a *App) GetUserAccessToken(tokenID string, sanitize bool) (*model.UserAccessToken, *model.AppError) {
token, err := a.Srv().Store.UserAccessToken().Get(tokenID)
if err != nil {
var nfErr *store.ErrNotFound
switch {