mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
use Result in GetAuthInfoQuery
This commit is contained in:
parent
d837be91ec
commit
65847da1df
@ -69,5 +69,5 @@ type GetAuthInfoQuery struct {
|
|||||||
AuthModule string
|
AuthModule string
|
||||||
AuthId string
|
AuthId string
|
||||||
|
|
||||||
UserAuth *UserAuth
|
Result *UserAuth
|
||||||
}
|
}
|
||||||
|
@ -28,22 +28,22 @@ func GetUserByAuthInfo(query *m.GetUserByAuthInfoQuery) error {
|
|||||||
|
|
||||||
err = GetAuthInfo(authQuery)
|
err = GetAuthInfo(authQuery)
|
||||||
// if user id was specified and doesn't match the user_auth entry, remove it
|
// if user id was specified and doesn't match the user_auth entry, remove it
|
||||||
if err == nil && query.UserId != 0 && query.UserId != authQuery.UserAuth.UserId {
|
if err == nil && query.UserId != 0 && query.UserId != authQuery.Result.UserId {
|
||||||
DeleteAuthInfo(&m.DeleteAuthInfoCommand{
|
DeleteAuthInfo(&m.DeleteAuthInfoCommand{
|
||||||
UserAuth: authQuery.UserAuth,
|
UserAuth: authQuery.Result,
|
||||||
})
|
})
|
||||||
} else if err == nil {
|
} else if err == nil {
|
||||||
has, err = x.Id(authQuery.UserAuth.UserId).Get(user)
|
has, err = x.Id(authQuery.Result.UserId).Get(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if has {
|
if has {
|
||||||
query.UserAuth = authQuery.UserAuth
|
query.UserAuth = authQuery.Result
|
||||||
} else {
|
} else {
|
||||||
// if the user has been deleted then remove the entry
|
// if the user has been deleted then remove the entry
|
||||||
DeleteAuthInfo(&m.DeleteAuthInfoCommand{
|
DeleteAuthInfo(&m.DeleteAuthInfoCommand{
|
||||||
UserAuth: authQuery.UserAuth,
|
UserAuth: authQuery.Result,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if err != m.ErrUserNotFound {
|
} else if err != m.ErrUserNotFound {
|
||||||
@ -99,7 +99,7 @@ func GetAuthInfo(query *m.GetAuthInfoQuery) error {
|
|||||||
return m.ErrUserNotFound
|
return m.ErrUserNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
query.UserAuth = userAuth
|
query.Result = userAuth
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user