diff --git a/http/user_service.go b/http/user_service.go index 238576c0ea..cbe41b6762 100644 --- a/http/user_service.go +++ b/http/user_service.go @@ -188,17 +188,9 @@ func (h *UserHandler) handleGetMe(w http.ResponseWriter, r *http.Request) { return } - switch s := a.(type) { - case *influxdb.Session: - if err := encodeResponse(ctx, w, http.StatusOK, newUserResponseFromSession(user, s)); err != nil { - EncodeError(ctx, err, w) - return - } - case *influxdb.Authorization: - if err := encodeResponse(ctx, w, http.StatusOK, newUserResponse(user)); err != nil { - EncodeError(ctx, err, w) - return - } + if err := encodeResponse(ctx, w, http.StatusOK, newUserResponse(user)); err != nil { + EncodeError(ctx, err, w) + return } } @@ -333,18 +325,6 @@ func newUserResponse(u *influxdb.User) *userResponse { } } -type userResponseFromSession struct { - *userResponse - OAuthID string `json:"oauthID,omitempty"` -} - -func newUserResponseFromSession(u *influxdb.User, s *influxdb.Session) *userResponseFromSession { - return &userResponseFromSession{ - userResponse: newUserResponse(u), - OAuthID: s.OAuthID, - } -} - // handleGetUsers is the HTTP handler for the GET /api/v2/users route. func (h *UserHandler) handleGetUsers(w http.ResponseWriter, r *http.Request) { ctx := r.Context() diff --git a/session.go b/session.go index 10664a30e3..8cdd6ad2d5 100644 --- a/session.go +++ b/session.go @@ -40,7 +40,6 @@ type Session struct { ExpiresAt time.Time `json:"expiresAt"` UserID ID `json:"userID,omitempty"` Permissions []Permission `json:"permissions,omitempty"` - OAuthID string `json:"oauthID,omitempty"` } // Expired returns an error if the session is expired. diff --git a/user.go b/user.go index 2461c18e8d..52c99d55e9 100644 --- a/user.go +++ b/user.go @@ -6,8 +6,9 @@ import ( // User is a user. 🎉 type User struct { - ID ID `json:"id,omitempty"` - Name string `json:"name"` + ID ID `json:"id,omitempty"` + Name string `json:"name"` + OAuthID string `json:"oauthID,omitempty"` } // Ops for user errors and op log.