Implement user sessions endpoints for APIv4 (#5449)
* added get session and revoke session endpoints, unittests and drivers * removed BasicUser2 and added teardown * added badrequest unit test case for sessions * added session loop to check if user id and session user id matches * fixed indentation issues for user_test * match indentation from spaces to tabs
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
2f96814a8b
Коммит
4e7dbc3bb0
@@ -4,6 +4,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"github.com/mattermost/platform/einterfaces"
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/utils"
|
||||
@@ -148,6 +149,7 @@ func RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId
|
||||
|
||||
func RevokeSessionById(sessionId string) *model.AppError {
|
||||
if result := <-Srv.Store.Session().Get(sessionId); result.Err != nil {
|
||||
result.Err.StatusCode = http.StatusBadRequest
|
||||
return result.Err
|
||||
} else {
|
||||
return RevokeSession(result.Data.(*model.Session))
|
||||
|
||||
Ссылка в новой задаче
Block a user