From 03c6dcbd865e2af2db5db150189504bfa493ae2e Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 15 Nov 2015 18:18:02 -0800 Subject: PLT-975 adding perm deletes --- store/sql_session_store.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'store/sql_session_store.go') diff --git a/store/sql_session_store.go b/store/sql_session_store.go index 27b34ee39..8237d8200 100644 --- a/store/sql_session_store.go +++ b/store/sql_session_store.go @@ -158,6 +158,24 @@ func (me SqlSessionStore) RemoveAllSessionsForTeam(teamId string) StoreChannel { return storeChannel } +func (me SqlSessionStore) RemoveAllSessionsForUser(userId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + _, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE UserId = :UserId", map[string]interface{}{"UserId": userId}) + if err != nil { + result.Err = model.NewAppError("SqlSessionStore.RemoveAllSessionsForUser", "We couldn't remove all the sessions for the user", "id="+userId+", err="+err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (me SqlSessionStore) CleanUpExpiredSessions(userId string) StoreChannel { storeChannel := make(StoreChannel) -- cgit v1.2.3-1-g7c22