summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/session_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimport/session_store.go')
-rw-r--r--src/helsinki.at/rhimport/session_store.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/helsinki.at/rhimport/session_store.go b/src/helsinki.at/rhimport/session_store.go
index 8b48c0a..e47366e 100644
--- a/src/helsinki.at/rhimport/session_store.go
+++ b/src/helsinki.at/rhimport/session_store.go
@@ -28,6 +28,7 @@ import (
"crypto/rand"
"encoding/base64"
"fmt"
+ "helsinki.at/rhrd-go/rddb"
"net/http"
)
@@ -90,7 +91,7 @@ type SessionStoreElement struct {
type SessionStore struct {
store map[string]map[string]*SessionStoreElement
conf *Config
- rddb *RdDbChan
+ db *rddb.DBChan
quit chan bool
done chan bool
newChan chan newSessionRequest
@@ -111,7 +112,7 @@ func (self *SessionStore) new(ctx *Context, refId string) (resp newSessionRespon
resp.responsecode = http.StatusOK
resp.errorstring = "OK"
if !ctx.Trusted {
- if ok, err := self.rddb.CheckPassword(ctx.UserName, ctx.Password); err != nil {
+ if ok, err := self.db.CheckPassword(ctx.UserName, ctx.Password); err != nil {
resp.responsecode = http.StatusInternalServerError
resp.errorstring = err.Error()
return
@@ -130,7 +131,7 @@ func (self *SessionStore) new(ctx *Context, refId string) (resp newSessionRespon
self.store[ctx.UserName] = make(map[string]*SessionStoreElement)
}
ctx.conf = self.conf
- ctx.rddb = self.rddb
+ ctx.db = self.db
s := &SessionStoreElement{newSession(ctx, func() { self.GetInterface().Remove(ctx.UserName, resp.id) }), refId}
self.store[ctx.UserName][resp.id] = s
resp.session = self.store[ctx.UserName][resp.id].s.getInterface()
@@ -156,7 +157,7 @@ func (self *SessionStore) list(user, password string, trusted bool) (resp listSe
resp.responsecode = http.StatusOK
resp.errorstring = "OK"
if !trusted {
- if ok, err := self.rddb.CheckPassword(user, password); err != nil {
+ if ok, err := self.db.CheckPassword(user, password); err != nil {
resp.responsecode = http.StatusInternalServerError
resp.errorstring = err.Error()
return
@@ -292,10 +293,10 @@ func (self *SessionStore) Cleanup() {
close(self.removeChan)
}
-func NewSessionStore(conf *Config, rddb *RdDbChan) (store *SessionStore, err error) {
+func NewSessionStore(conf *Config, db *rddb.DBChan) (store *SessionStore, err error) {
store = new(SessionStore)
store.conf = conf
- store.rddb = rddb
+ store.db = db
store.quit = make(chan bool)
store.done = make(chan bool)
store.store = make(map[string]map[string]*SessionStoreElement)