Ensure that the NS and DB are available to the live query
This commit is contained in:
parent
1200b6c209
commit
b4c49a7099
2 changed files with 5 additions and 2 deletions
|
@ -52,7 +52,7 @@ func (d *document) lives(ctx context.Context, when method) (err error) {
|
||||||
|
|
||||||
if con, ok = sockets[lv.FB]; ok {
|
if con, ok = sockets[lv.FB]; ok {
|
||||||
|
|
||||||
ctx = con.ctx()
|
ctx = con.ctx(d.ns, d.db)
|
||||||
|
|
||||||
// Check whether this live query has the
|
// Check whether this live query has the
|
||||||
// necessary permissions to view this
|
// necessary permissions to view this
|
||||||
|
|
|
@ -48,10 +48,13 @@ func flush() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *socket) ctx() (ctx context.Context) {
|
func (s *socket) ctx(ns, db string) (ctx context.Context) {
|
||||||
|
|
||||||
ctx = context.Background()
|
ctx = context.Background()
|
||||||
|
|
||||||
|
ctx = context.WithValue(ctx, ctxKeyNs, ns)
|
||||||
|
ctx = context.WithValue(ctx, ctxKeyDb, db)
|
||||||
|
|
||||||
auth := s.fibre.Get(varKeyAuth).(*cnf.Auth)
|
auth := s.fibre.Get(varKeyAuth).(*cnf.Auth)
|
||||||
ctx = context.WithValue(ctx, ctxKeyAuth, auth.Data)
|
ctx = context.WithValue(ctx, ctxKeyAuth, auth.Data)
|
||||||
ctx = context.WithValue(ctx, ctxKeyKind, auth.Kind)
|
ctx = context.WithValue(ctx, ctxKeyKind, auth.Kind)
|
||||||
|
|
Loading…
Reference in a new issue