-
Notifications
You must be signed in to change notification settings - Fork 309
feat: add SCIM 2.0 user provisioning (EE) #1306
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
Open
brendan-kellam
wants to merge
18
commits into
main
Choose a base branch
from
brendan/scim-user-provisioning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e0b9f02
feat: add SCIM 2.0 user provisioning (EE)
brendan-kellam c09dda4
derive org from scim token
brendan-kellam ed5bc42
await onCreateUser call
brendan-kellam 5648957
nit
brendan-kellam c5439a3
Merge branch 'main' into brendan/scim-user-provisioning
brendan-kellam b5a682f
Merge branch 'main' into brendan/scim-user-provisioning
brendan-kellam 199c2bd
refactor
brendan-kellam d50d008
Add isActive to db fetches where necessary
brendan-kellam 260b789
ensureActiveMember
brendan-kellam 2234f8d
Merge branch 'main' into brendan/scim-user-provisioning
brendan-kellam e06991c
feat(web): track per-org member activity and bill only active-seen me…
brendan-kellam b9d36a3
members table v2
brendan-kellam 12355df
change isActive to suspendedAt
brendan-kellam 1d3a2fd
handle pending -> active state with a capped organization
brendan-kellam 36ac38c
tighten control under what state a member can be demoted / promoted
brendan-kellam 11b1607
add create invite dialog
brendan-kellam 0188377
s
brendan-kellam aea480b
encode filter in query params
brendan-kellam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
29 changes: 29 additions & 0 deletions
29
packages/db/prisma/migrations/20260619214548_add_scim_users_support/migration.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "Org" ADD COLUMN "isScimEnabled" BOOLEAN NOT NULL DEFAULT false; | ||
|
|
||
| -- AlterTable | ||
| ALTER TABLE "UserToOrg" ADD COLUMN "suspendedAt" TIMESTAMP(3), | ||
| ADD COLUMN "scimExternalId" TEXT; | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "ScimToken" ( | ||
| "name" TEXT NOT NULL, | ||
| "hash" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "lastUsedAt" TIMESTAMP(3), | ||
| "orgId" INTEGER NOT NULL, | ||
|
|
||
| CONSTRAINT "ScimToken_pkey" PRIMARY KEY ("hash") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "ScimToken_hash_key" ON "ScimToken"("hash"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ScimToken_orgId_idx" ON "ScimToken"("orgId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "UserToOrg_orgId_scimExternalId_idx" ON "UserToOrg"("orgId", "scimExternalId"); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "ScimToken" ADD CONSTRAINT "ScimToken_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "Org"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
15 changes: 15 additions & 0 deletions
15
packages/db/prisma/migrations/20260624194710_add_lastactiveat_to_usertoorg/migration.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "UserToOrg" ADD COLUMN "lastActiveAt" TIMESTAMP(3); | ||
|
|
||
| -- Backfill per-membership activity from the global User.lastActiveAt. In a | ||
| -- single-tenant deployment a user belongs to exactly one org, so the global | ||
| -- timestamp is exactly the per-org timestamp. In multi-tenant deployments this | ||
| -- seeds every membership with the user's global last-active time as the best | ||
| -- available signal; the per-org value diverges naturally from the next | ||
| -- authenticated action onward. Without this, every existing membership would | ||
| -- read as "never active" (NULL) until each member's next request. | ||
| UPDATE "UserToOrg" AS uto | ||
| SET "lastActiveAt" = u."lastActiveAt" | ||
| FROM "User" AS u | ||
| WHERE uto."userId" = u."id" | ||
| AND u."lastActiveAt" IS NOT NULL; |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enforce per-org uniqueness for SCIM
externalId.scimExternalIdcurrently has only a non-unique index, which permits duplicate IdP identities inside the same org and can make SCIM identity resolution/update flows ambiguous.Suggested schema fix
📝 Committable suggestion
🤖 Prompt for AI Agents