diff --git a/db/lives.go b/db/lives.go index b1cb646f..981af65c 100644 --- a/db/lives.go +++ b/db/lives.go @@ -52,7 +52,7 @@ func (d *document) lives(ctx context.Context, when method) (err error) { if con, ok = sockets[lv.FB]; ok { - ctx = con.ctx() + ctx = con.ctx(d.ns, d.db) // Check whether this live query has the // necessary permissions to view this diff --git a/db/socket.go b/db/socket.go index 317bcdba..ff08b796 100644 --- a/db/socket.go +++ b/db/socket.go @@ -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.WithValue(ctx, ctxKeyNs, ns) + ctx = context.WithValue(ctx, ctxKeyDb, db) + auth := s.fibre.Get(varKeyAuth).(*cnf.Auth) ctx = context.WithValue(ctx, ctxKeyAuth, auth.Data) ctx = context.WithValue(ctx, ctxKeyKind, auth.Kind)