Skip to content

Fix: Display resources the first time a GitHub user logs in. - #189

Open
mariodruiz wants to merge 3 commits into
AMDResearch:developfrom
mariodruiz:fix/ui-resources
Open

Fix: Display resources the first time a GitHub user logs in.#189
mariodruiz wants to merge 3 commits into
AMDResearch:developfrom
mariodruiz:fix/ui-resources

Conversation

@mariodruiz

Copy link
Copy Markdown
Contributor

Summary

GitHub users saw an empty Home page on first login. Resources only appeared after opening the spawner once. This PR aims at sync'ing the teams when the user logs in.

Checklist

  • Code follows project style guidelines
  • Changes are backward compatible
  • Tested on local Kubernetes cluster
  • Documentation links updated

…visit

Group/team sync ran only in Spawner.auth_state_hook, so new users saw no
resources on Home until they opened Spawner once. Move default group
assignment and GitHub team sync into a shared ensure_user_group_membership()
helper called from Authenticator.add_user (where the ORM user and db session
exist, unlike post_auth_hook). Wire it on the GitHub and FirstUse
authenticators, and delegate add_user through CustomMultiAuthenticator since
MultiAuthenticator does not by default. auth_state_hook now only propagates
the GitHub token and refreshes teams (TTL-cached) at spawn. Team sync is
skipped on hub restart for users who already have team groups to avoid
redundant GitHub API calls.
@mariodruiz

Copy link
Copy Markdown
Contributor Author

Squash commits before merging.

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.

1 participant