Repository navigation
Admin: link a tenant to its IdP org, and delete an organisation - #6
Merged
Merged
Conversation
A tenant made in the app is never matched to an issuer org by slug, so the org's first sign-in made a second tenant. A global admin now sets or clears tenants.external_org_id (409 external_org_taken when another tenant holds it), and can delete an organisation, including an ownerless one managed tenancy created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem: under IdP-managed tenancy, a tenant someone made in the app has no
external_org_id. So the org's first sign-in creates a second tenant (psychiatry-uk-2in Unwind). The kit can't match by slug, because any user may create a tenant and could take a client's slug first. That second tenant has no owner, so nobody could delete it.Global admins now have two new controls:
PUT /api/admin/tenants/:id/external-org { externalOrgId | null }links or unlinks the tenant.external_org_taken(naming the tenant that holds it) when another tenant is linked to that org.tenant.idp_linked/tenant.idp_unlinked.DELETE /api/admin/tenants/:id { confirm: slug }reuses the owner'sdeleteTenant: the cascade, thentenant.purge. The deletion is logged, since the tenant's activity log goes with it.The admin tenant DTOs gain
externalOrgId, and the detail gainsidpManaged. CONCEPTS §2 documents linking.Tests: link, conflict, unlink and activity; admin-only; delete with slug confirmation; a linked hand-made tenant is the one the org signs in to.
pnpm gatepasses, apart from kit-manifest locally, which only fails because of untrackeddocs/unwind/files.🤖 Generated with Claude Code