summaryrefslogtreecommitdiffstats
path: root/store/sql_session_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sql_session_store.go')
-rw-r--r--store/sql_session_store.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/store/sql_session_store.go b/store/sql_session_store.go
index 4e1bea3cf..5892dab01 100644
--- a/store/sql_session_store.go
+++ b/store/sql_session_store.go
@@ -168,6 +168,28 @@ func (me SqlSessionStore) GetSessions(userId string) StoreChannel {
return storeChannel
}
+func (me SqlSessionStore) GetSessionsWithActiveDeviceIds(userId string) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+
+ result := StoreResult{}
+ var sessions []*model.Session
+
+ if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE UserId = :UserId AND ExpiresAt != 0 AND :ExpiresAt <= ExpiresAt AND DeviceId != ''", map[string]interface{}{"UserId": userId, "ExpiresAt": model.GetMillis()}); err != nil {
+ result.Err = model.NewLocAppError("SqlSessionStore.GetActiveSessionsWithDeviceIds", "store.sql_session.get_sessions.app_error", nil, err.Error())
+ } else {
+
+ result.Data = sessions
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
func (me SqlSessionStore) Remove(sessionIdOrToken string) StoreChannel {
storeChannel := make(StoreChannel, 1)