Skip to content

[server/fga] centralize lookup of findUserById #18382

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

Merged
merged 1 commit into from
Jul 31, 2023
Merged

Conversation

svenefftinge
Copy link
Member

@svenefftinge svenefftinge commented Jul 28, 2023

Description

We want to use UserService#findUserById as a central point for running the FGA migrations. In that light we need to make sure that our system is not bypassing the userServices (should do that anyway) and directly use the userDb.
This PR replaces the usages of UserDB#findUserByID with UserService#findUserById

Summary generated by Copilot

🤖 Generated by Copilot at 53b6a2e

This pull request refactors various classes that deal with user-related operations to use the UserService and UserAuthentication services instead of the UserDB, to improve the consistency and reliability of the user data and the authorization logic. It also reorders some imports and adds error handling and logging where needed. The affected classes include Authenticator, BearerAuth, BitbucketApp, BitbucketServerApp, GithubApp, GitHubEnterpriseApp, GitLabApp, SessionHandler, UserController, and GitpodServerImpl.

Related Issue(s)

Fixes EXP-286

How to test

In addition the unit tests I spun up a preview environment to verify that these changes don't break any user flows.

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@svenefftinge svenefftinge force-pushed the se/hook-up-migration branch from d9c935c to 6c8712e Compare July 30, 2023 18:12

if (p) {
if (p.userId) {
Copy link
Member

Choose a reason for hiding this comment

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

@svenefftinge I'm not sure why is it alright to remove this case? Because the property is going to be removed?

Copy link
Member

Choose a reason for hiding this comment

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

it seems it was added for #5128

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I should have added a comment here. We have removed personal projects and this was a left over. I will go through the code and see if we can remove the userID from project all together in a separate PR.

@akosyakov
Copy link
Member

I still can find calls to userDB.findUserById in gitpod-sever-impl for admin* methods intentional?

@akosyakov
Copy link
Member

akosyakov commented Jul 31, 2023

JWT cookie will migrate, but bearer tokens (only older, newer will too) and oauth2 client integrations won't, intentional?

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

I reviewed code and did a smoke test. It generally makes sense to me. Not sure how test impact on prebuilds, on first glance should be ok.

/hold

@svenefftinge
Copy link
Member Author

/unhold

@roboquat roboquat merged commit c2e498b into main Jul 31, 2023
@roboquat roboquat deleted the se/hook-up-migration branch July 31, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants