Repository navigation
IdP-managed tenancy: an unlinked tenant with the org's slug becomes its tenant - #7
Merged
Merged
Conversation
…ts tenant On an org's first sign-in, the unlinked tenant whose slug is the claim's slug is linked to the org instead of a second tenant being created. A tenant linked to another org is never taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On an org's first sign-in, an unlinked tenant whose slug equals the claim's
slugis linked to the org (linkTenantBySlug) instead of a second tenant being created. This covers tenants made by hand or before managed tenancy, as withpsychiatry-uk→psychiatry-uk-2in Unwind.UPDATE … WHERE slug = ? AND external_org_id IS NULL. A concurrent sign-in that links or creates the tenant first is found on the next pass.Tests replace "found by its id, never by slug" with: adoption by slug (owner stays, no
-2), and a same-slug tenant linked to another org is never taken.pnpm gatepasses, apart from kit-manifest locally, which fails only because of untrackeddocs/unwind/files.🤖 Generated with Claude Code