fix(auth): restore admin gate on OAuth toggle-disabled after ADR-0068#2450
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 10 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
The /admin/oauth-application/toggle-disabled route still gated on `session.user.role !== 'admin'`, a signal ADR-0068 stopped synthesizing. Mirror the sibling /admin/unlock-user gate (isPlatformAdmin / platform_admin in roles[] / legacy role scalar). Also correct the stale customSession() doc comment that still described the removed user.role overwrite.
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.
What
ADR-0068 (
a3a5abff8) stopped the servercustomSessionfrom synthesizinguser.role = 'admin'. Canonical roles now arrive inuser.roles[](platform_admin/org_*) withuser.isPlatformAdminas a derived alias.The OAuth-client enable/disable route —
POST {basePath}/admin/oauth-application/toggle-disabledinauth-plugin.ts— was missed in that migration and still gated on:Since
user.roleis no longer synthesized, this now rejects even platform admins (unless the admin-plugin literally stored the'admin'scalar on their row). The sibling/admin/unlock-userroute in the same file was migrated correctly; this one was not.Fix
Gate on the same three canonical signals as
/admin/unlock-user:Also corrects the stale
customSession()doc comment inauth-manager.tsthat still described the removeduser.role = 'admin'overwrite (the very pattern downstream consumers copied).The pre-ADR-0068
role === 'admin'check implicitly allowed active-org owners/admins too (they were synthesized torole='admin'), as the old comment stated. This fix makes the gate platform-admin-only, matching the siblingunlock-userroute and treating OAuth-client management as an instance-level concern. If org owners/admins are intended to manage OAuth clients, addorg_owner/org_adminto theroles[]check — flagging explicitly so this is a conscious decision rather than a silent change.Verification
@objectstack/plugin-authbuild + DTS type-check clean.patch).Companion
objectui #2063 fixes the same missed migration on the client (4 views gating on
user?.role === 'admin').