mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
switch to Result
This commit is contained in:
@@ -71,17 +71,17 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
|
||||
}
|
||||
|
||||
// add/update user in grafana
|
||||
userQuery := &m.UpsertUserCommand{
|
||||
cmd := &m.UpsertUserCommand{
|
||||
ExternalUser: &extUser,
|
||||
SignupAllowed: setting.AuthProxyAutoSignUp,
|
||||
}
|
||||
err := login.UpsertUser(ctx, userQuery)
|
||||
err := login.UpsertUser(ctx, cmd)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "Failed to login as user specified in auth proxy header", err)
|
||||
return true
|
||||
}
|
||||
|
||||
query.UserId = userQuery.User.Id
|
||||
query.UserId = cmd.Result.Id
|
||||
|
||||
if err := bus.Dispatch(query); err != nil {
|
||||
ctx.Handle(500, "Failed to find user", err)
|
||||
|
||||
@@ -184,7 +184,7 @@ func TestMiddlewareContext(t *testing.T) {
|
||||
})
|
||||
|
||||
login.UpsertUser = func(ctx *m.ReqContext, cmd *m.UpsertUserCommand) error {
|
||||
cmd.User = &m.User{Id: 12}
|
||||
cmd.Result = &m.User{Id: 12}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ func TestMiddlewareContext(t *testing.T) {
|
||||
})
|
||||
|
||||
login.UpsertUser = func(ctx *m.ReqContext, cmd *m.UpsertUserCommand) error {
|
||||
cmd.User = &m.User{Id: 33}
|
||||
cmd.Result = &m.User{Id: 33}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ func TestMiddlewareContext(t *testing.T) {
|
||||
})
|
||||
|
||||
login.UpsertUser = func(ctx *m.ReqContext, cmd *m.UpsertUserCommand) error {
|
||||
cmd.User = &m.User{Id: 33}
|
||||
cmd.Result = &m.User{Id: 33}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user