Chore: add context to login (#41316)

* Chore: add context to login attempt file and tests

* Chore: add context

* Chore: add context to login and login tests

* Chore: continue adding context to login

* Chore: add context to login query
This commit is contained in:
Katarina Yang
2021-11-08 15:53:51 +01:00
committed by GitHub
parent b58cca5d51
commit c4306f9b3e
22 changed files with 90 additions and 78 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
package api
import (
"context"
"errors"
"fmt"
@@ -123,7 +124,7 @@ func (hs *HTTPServer) AdminDisableUser(c *models.ReqContext) response.Response {
// External users shouldn't be disabled from API
authInfoQuery := &models.GetAuthInfoQuery{UserId: userID}
if err := bus.Dispatch(authInfoQuery); !errors.Is(err, models.ErrUserNotFound) {
if err := bus.DispatchCtx(context.TODO(), authInfoQuery); !errors.Is(err, models.ErrUserNotFound) {
return response.Error(500, "Could not disable external user", nil)
}
@@ -149,7 +150,7 @@ func AdminEnableUser(c *models.ReqContext) response.Response {
// External users shouldn't be disabled from API
authInfoQuery := &models.GetAuthInfoQuery{UserId: userID}
if err := bus.Dispatch(authInfoQuery); !errors.Is(err, models.ErrUserNotFound) {
if err := bus.DispatchCtx(context.TODO(), authInfoQuery); !errors.Is(err, models.ErrUserNotFound) {
return response.Error(500, "Could not enable external user", nil)
}