bus: add ctx for all signed in user queries (#33970)

Signed-off-by: bergquist <carl.bergquist@gmail.com>
This commit is contained in:
Carl Bergquist
2021-05-18 18:24:42 +02:00
committed by GitHub
parent 5721019573
commit 4710566514
13 changed files with 38 additions and 34 deletions

View File

@@ -237,7 +237,7 @@ func (h *ContextHandler) initContextWithBasicAuth(ctx *models.ReqContext, orgID
user := authQuery.User
query := models.GetSignedInUserQuery{UserId: user.Id, OrgId: orgID}
if err := bus.Dispatch(&query); err != nil {
if err := bus.DispatchCtx(ctx.Req.Context(), &query); err != nil {
ctx.Logger.Error(
"Failed at user signed in",
"id", user.Id,
@@ -270,7 +270,7 @@ func (h *ContextHandler) initContextWithToken(ctx *models.ReqContext, orgID int6
}
query := models.GetSignedInUserQuery{UserId: token.UserId, OrgId: orgID}
if err := bus.Dispatch(&query); err != nil {
if err := bus.DispatchCtx(ctx.Req.Context(), &query); err != nil {
ctx.Logger.Error("Failed to get user with id", "userId", token.UserId, "error", err)
return false
}