From ea3342aa6c93579d41de3f6005c12a201b21ee6e Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Fri, 3 Jun 2016 09:33:59 -0400 Subject: Adding LDAP Syncronization (#3219) --- api/user.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'api') diff --git a/api/user.go b/api/user.go index 4d4518824..de7a560bf 100644 --- a/api/user.go +++ b/api/user.go @@ -704,6 +704,7 @@ func RevokeSessionById(c *Context, sessionId string) { } } +// IF YOU UPDATE THIS PLEASE UPDATE BELOW func RevokeAllSession(c *Context, userId string) { if result := <-Srv.Store.Session().GetSessions(userId); result.Err != nil { c.Err = result.Err @@ -726,6 +727,28 @@ func RevokeAllSession(c *Context, userId string) { } } +// UGH... +// If you update this please update above +func RevokeAllSessionsNoContext(userId string) *model.AppError { + if result := <-Srv.Store.Session().GetSessions(userId); result.Err != nil { + return result.Err + } else { + sessions := result.Data.([]*model.Session) + + for _, session := range sessions { + if session.IsOAuth { + RevokeAccessToken(session.Token) + } else { + sessionCache.Remove(session.Token) + if result := <-Srv.Store.Session().Remove(session.Id); result.Err != nil { + return result.Err + } + } + } + } + return nil +} + func getSessions(c *Context, w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) -- cgit v1.2.3-1-g7c22