Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional endpoints for editing RFDs #150

Merged
merged 27 commits into from
May 14, 2024
Merged

Add additional endpoints for editing RFDs #150

merged 27 commits into from
May 14, 2024

Conversation

augustuswm
Copy link
Contributor

Adds a number of endpoints for managing RFD contents and state:

  • POST /rfd/{number} - Replace the full document of a RFD
  • POST /rfd/{number}/content - Replace the contents of a RFD
  • POST /rfd/{number}/attr/{attr} - Set an attribute of a RFD
  • POST /rfd/{number}/discuss - Open a RFD for discussion
  • POST /rfd/{number}/publish - Publish a RFD

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has checked 186 files.

Valid Invalid Ignored Fixed
97 1 88 0
Click to see the invalid file list
  • rfd-data/src/content/template.rs
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

rfd-data/src/content/template.rs Show resolved Hide resolved
@benjaminleonard
Copy link
Contributor

Is it possible to inject the author automatically on the new RFD endpoint? Not sure if you have the user's name and email already? In general I think we could benefit from a /user/{id} that returns user info. That'd also mean I could display the owner of a note when they are shared.

@augustuswm
Copy link
Contributor Author

Currently it doesn't link the author intentionally. While we do have the login email from the underlying oauth provider, we do not have a way for users to select which email is preferred. The plan is support all of this with a profile feature in the future that allows for selecting a preferred email and a display name.

User information can be retrieved from /user/{id} or /self, but you need to have permission to read the information about the that user. In our deployment that means being an admin or being the user themselves. My recommendation then you be to call that endpoint during login and save it alongside the note.

@benjaminleonard
Copy link
Contributor

Ok perfect, I'll give that a go.

Does that information change depending on whether it's a GitHub or Google login? Does google provide a display name?

@augustuswm
Copy link
Contributor Author

augustuswm commented Apr 30, 2024

We currently do not support a display name for Google logins, GitHub logins will list their username. You will get back a response something like this:

{
  "info": {
    "created_at": "2024-01-11T20:03:44.596284Z",
    "groups": [
      "0956e838-7ded-447d-adf1-3640d0fb8d52",
      // ...
    ],
    "id": "4991a960-a4ee-4ced-88e2-49e1d931c791",
    "permissions": [
      {
        "kind": "UpdateRfds",
        "value": []
      },
      // ...
    ],
    "updated_at": "2024-04-30T13:16:04.629468Z"
  },
  "providers": [
    {
      "api_user_id": "4991a960-a4ee-4ced-88e2-49e1d931c791",
      "created_at": "2024-01-11T20:03:44.598066Z",
      "display_names": [],
      "emails": [
        "[email protected]"
      ],
      "id": "c9cc41a2-1a8d-4c91-a46e-fce5cc723f8c",
      "provider": "google",
      "provider_id": "<redacted>",
      "updated_at": "2024-04-30T13:16:04.626114Z"
    }
  ]
}

Currently users will have exactly one provider (either GitHub or Google), but that is soon to change. The other thing to be mindful of is that the emails field contains all verified emails that the provider gave us back. There are no guarantees made about the order in which they appear so you will need to filter them for the specific relevant ones (i.e. @oxidecomputer.com or @oxide.computer.

@augustuswm augustuswm merged commit e0e20ea into main May 14, 2024
12 checks passed
@augustuswm augustuswm deleted the new-rfd branch May 14, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants