influxdata / influxdata/influxdb

InfluxDB 2.x Swagger: OauthID is not updated when PATCH is sent to `/users/{userID}`

Open
#19,385 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/2.x
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

@stephanie-engel commented on [Tue Jul 21 2020](https://github.com/influxdata/idpe/issues/7982)

**Issue:**
When an updated value for `oauthID` is sent in a PATCH request to `/users/{userID}` from either OSS 2.X or Cloud2, the oauthID is not updated.

Cloud2 example:

1) Create new user:
```
sengel ~ $ curl --location --request POST 'http://gateway-main.se-cluster.svc.cluster.local:9999/api/v2/users' \
> --header 'Zap-Trace-Span: ' \
> --header 'Content-Type: application/json' \
> --header 'Authorization: Token my-token' \
> --data-raw '{
> "name": "a-great-user",
> "oauthID": "123oauthidbaby",
> "status": "active"
> }'
{
"links": {
"self": "/api/v2/users/0608cc7a6f77d000"
},
"id": "0608cc7a6f77d000",
"name": "a-great-user",
"oauthID": "originalOauthid",
"status": "active"
}
```

2) Update user's name, oauth, and status:
```
sengel ~ $ curl --location --request PATCH 'http://gateway-main.se-cluster.svc.cluster.local:9999/api/v2/users/0608cc7a6f77d000' \
> --header 'Zap-Trace-Span: ' \
> --header 'Content-Type: application/json' \
> --header 'Authorization: Token Q_7rA8FO2EQapmbrNQ_lVAFv1AUGVMfM1an__Vkqcn2NqEY955bELbl5job3i9pT7cJi36aT54r3WthpM2ysTg==' \
> --data-raw '{
> "name": "better-name",
> "oauthID": "differentOauthID",
> "status": "inactive"
> }'
{
"links": {
"self": "/api/v2/users/0608cc7a6f77d000"
},
"id": "0608cc7a6f77d000",
"name": "better-name",
"oauthID": "originalOauthid",
"status": "inactive"
}
```

In the above example, the `ouathID` remained unchanged:`originalOauthid`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the PATCH /users/{userID} endpoint and reproduce the Cloud2 example with a changed oauthID. Check where the request fields are applied and verify that the updated oauthID is returned and persists after the request.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api, authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.