mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Rename DispatchCtx to Dispatch (#43563)
This commit is contained in:
@@ -146,7 +146,7 @@ func (h *ContextHandler) Middleware(mContext *web.Context) {
|
||||
// update last seen every 5min
|
||||
if reqContext.ShouldUpdateLastSeenAt() {
|
||||
reqContext.Logger.Debug("Updating last user_seen_at", "user_id", reqContext.UserId)
|
||||
if err := bus.DispatchCtx(mContext.Req.Context(), &models.UpdateUserLastSeenAtCommand{UserId: reqContext.UserId}); err != nil {
|
||||
if err := bus.Dispatch(mContext.Req.Context(), &models.UpdateUserLastSeenAtCommand{UserId: reqContext.UserId}); err != nil {
|
||||
reqContext.Logger.Error("Failed to update last_seen_at", "error", err)
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ func (h *ContextHandler) initContextWithAPIKey(reqContext *models.ReqContext) bo
|
||||
|
||||
// fetch key
|
||||
keyQuery := models.GetApiKeyByNameQuery{KeyName: decoded.Name, OrgId: decoded.OrgId}
|
||||
if err := bus.DispatchCtx(reqContext.Req.Context(), &keyQuery); err != nil {
|
||||
if err := bus.Dispatch(reqContext.Req.Context(), &keyQuery); err != nil {
|
||||
reqContext.JsonApiErr(401, InvalidAPIKey, err)
|
||||
return true
|
||||
}
|
||||
@@ -246,7 +246,7 @@ func (h *ContextHandler) initContextWithAPIKey(reqContext *models.ReqContext) bo
|
||||
|
||||
//Use service account linked to API key as the signed in user
|
||||
query := models.GetSignedInUserQuery{UserId: apikey.ServiceAccountId, OrgId: apikey.OrgId}
|
||||
if err := bus.DispatchCtx(reqContext.Req.Context(), &query); err != nil {
|
||||
if err := bus.Dispatch(reqContext.Req.Context(), &query); err != nil {
|
||||
reqContext.Logger.Error(
|
||||
"Failed to link API key to service account in",
|
||||
"id", query.UserId,
|
||||
@@ -286,7 +286,7 @@ func (h *ContextHandler) initContextWithBasicAuth(reqContext *models.ReqContext,
|
||||
Password: password,
|
||||
Cfg: h.Cfg,
|
||||
}
|
||||
if err := bus.DispatchCtx(reqContext.Req.Context(), &authQuery); err != nil {
|
||||
if err := bus.Dispatch(reqContext.Req.Context(), &authQuery); err != nil {
|
||||
reqContext.Logger.Debug(
|
||||
"Failed to authorize the user",
|
||||
"username", username,
|
||||
@@ -303,7 +303,7 @@ func (h *ContextHandler) initContextWithBasicAuth(reqContext *models.ReqContext,
|
||||
user := authQuery.User
|
||||
|
||||
query := models.GetSignedInUserQuery{UserId: user.Id, OrgId: orgID}
|
||||
if err := bus.DispatchCtx(ctx, &query); err != nil {
|
||||
if err := bus.Dispatch(ctx, &query); err != nil {
|
||||
reqContext.Logger.Error(
|
||||
"Failed at user signed in",
|
||||
"id", user.Id,
|
||||
@@ -339,7 +339,7 @@ func (h *ContextHandler) initContextWithToken(reqContext *models.ReqContext, org
|
||||
}
|
||||
|
||||
query := models.GetSignedInUserQuery{UserId: token.UserId, OrgId: orgID}
|
||||
if err := bus.DispatchCtx(ctx, &query); err != nil {
|
||||
if err := bus.Dispatch(ctx, &query); err != nil {
|
||||
reqContext.Logger.Error("Failed to get user with id", "userId", token.UserId, "error", err)
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user