Updating oauth user lookup call as per PR feedback. T710
This commit is contained in:
parent
6d8da2bffd
commit
0b229a5ede
2 changed files with 15 additions and 15 deletions
4
oauth.go
4
oauth.go
|
@ -63,7 +63,7 @@ type OAuthDatastore interface {
|
||||||
GenerateOAuthState(context.Context, string, string) (string, error)
|
GenerateOAuthState(context.Context, string, string) (string, error)
|
||||||
|
|
||||||
CreateUser(*config.Config, *User, string) error
|
CreateUser(*config.Config, *User, string) error
|
||||||
GetUserForAuthByID(int64) (*User, error)
|
GetUserByID(int64) (*User, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type HttpClient interface {
|
type HttpClient interface {
|
||||||
|
@ -209,7 +209,7 @@ func (h oauthHandler) viewOauthCallback(app *App, w http.ResponseWriter, r *http
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := h.DB.GetUserForAuthByID(localUserID)
|
user, err := h.DB.GetUserByID(localUserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return impart.HTTPError{http.StatusInternalServerError, err.Error()}
|
return impart.HTTPError{http.StatusInternalServerError, err.Error()}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ type MockOAuthDatastore struct {
|
||||||
DoGetIDForRemoteUser func(context.Context, string, string, string) (int64, error)
|
DoGetIDForRemoteUser func(context.Context, string, string, string) (int64, error)
|
||||||
DoCreateUser func(*config.Config, *User, string) error
|
DoCreateUser func(*config.Config, *User, string) error
|
||||||
DoRecordRemoteUserID func(context.Context, int64, string, string, string, string) error
|
DoRecordRemoteUserID func(context.Context, int64, string, string, string, string) error
|
||||||
DoGetUserForAuthByID func(int64) (*User, error)
|
DoGetUserByID func(int64) (*User, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ OAuthDatastore = &MockOAuthDatastore{}
|
var _ OAuthDatastore = &MockOAuthDatastore{}
|
||||||
|
@ -115,9 +115,9 @@ func (m *MockOAuthDatastore) RecordRemoteUserID(ctx context.Context, localUserID
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MockOAuthDatastore) GetUserForAuthByID(userID int64) (*User, error) {
|
func (m *MockOAuthDatastore) GetUserByID(userID int64) (*User, error) {
|
||||||
if m.DoGetUserForAuthByID != nil {
|
if m.DoGetUserByID != nil {
|
||||||
return m.DoGetUserForAuthByID(userID)
|
return m.DoGetUserByID(userID)
|
||||||
}
|
}
|
||||||
user := &User{
|
user := &User{
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue