summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-06-03 09:33:59 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-06-03 09:33:59 -0400
commitea3342aa6c93579d41de3f6005c12a201b21ee6e (patch)
tree560ab58429ead414ffd3eb730d462e687db48d7f /api
parent87f357a54d0dccf09b6b6f20f64b08ef3ca2e1f2 (diff)
downloadchat-ea3342aa6c93579d41de3f6005c12a201b21ee6e.tar.gz
chat-ea3342aa6c93579d41de3f6005c12a201b21ee6e.tar.bz2
chat-ea3342aa6c93579d41de3f6005c12a201b21ee6e.zip
Adding LDAP Syncronization (#3219)
Diffstat (limited to 'api')
-rw-r--r--api/user.go23
1 files changed, 23 insertions, 0 deletions
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)