[GH-ISSUE #9186] tracking: admin plugin: super-admin scope, impersonation, permission math #28627

Open
opened 2026-04-17 20:03:24 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @gustavovalverde on GitHub (Apr 14, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/9186

Summary

This tracker covers the admin-plugin work that sits outside dynamic-role lifecycle changes. The open sub-issues focus on cross-org super-admin scope, impersonation behavior, team-role assignment, permission union math, role helpers, schema alignment, client cache invalidation, and role data on user list responses. One typing symptom at the invite endpoint belongs here because it follows the broader admin endpoint pattern.

Root cause

The admin plugin models same-org administration more directly than cross-org administration. Super-admin authority is not expressed as one explicit scope. Impersonation is exposed as an API request without one documented contract or one aligned schema for impersonatedBy. Team-role assignment is missing. Permission checks do not always union multiple assigned roles correctly. Access-control overrides cannot fully replace built-in behavior. Client role state can also remain stale after sign-out, and some admin endpoints do not expose a consistent dynamic-role TypeScript surface or return org role data in user-shaped responses.

Scope

In: platform admin vs org admin authority, impersonation contract and schema, team-role assignment, permission union math, access-control override, client-side role-cache invalidation, dynamic-role TS surface on admin endpoints, role surfacing on user list responses.

Out: dynamic-role creation/rename lifecycle (covered by #4557 rescoped tracker). Session cookie cache invalidation (cross-reference to tracking: session cookie cache).

Resolution criteria

  • Super-admin authority is expressed and enforced across orgs.
  • Impersonation has a documented contract; impersonatedBy types align with the id strategy.
  • Team-role assignment has a stable API.
  • hasPermission returns the correct union across multiple role assignments.
  • A user-shaped role helper exists.
  • Built-in access-control rules are overridable.
  • The client invalidates the role cache on sign-out without a manual refetch.
  • Dynamic-role operations typecheck at every endpoint that accepts a role input, including invite.
  • User list responses carry org role where applicable.
  • Sibling: tracking: admin/org dynamic-role lifecycle (#4557 rescoped).
  • Cross-reference: tracking: session cookie cache for the role-cache invalidation path.
  • Prior closed context: #7315 (endpoint/docs mismatch).
Originally created by @gustavovalverde on GitHub (Apr 14, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/9186 ## Summary This tracker covers the admin-plugin work that sits outside dynamic-role lifecycle changes. The open sub-issues focus on cross-org super-admin scope, impersonation behavior, team-role assignment, permission union math, role helpers, schema alignment, client cache invalidation, and role data on user list responses. One typing symptom at the invite endpoint belongs here because it follows the broader admin endpoint pattern. ## Root cause The admin plugin models same-org administration more directly than cross-org administration. Super-admin authority is not expressed as one explicit scope. Impersonation is exposed as an API request without one documented contract or one aligned schema for `impersonatedBy`. Team-role assignment is missing. Permission checks do not always union multiple assigned roles correctly. Access-control overrides cannot fully replace built-in behavior. Client role state can also remain stale after sign-out, and some admin endpoints do not expose a consistent dynamic-role TypeScript surface or return org role data in user-shaped responses. ## Scope **In:** platform admin vs org admin authority, impersonation contract and schema, team-role assignment, permission union math, access-control override, client-side role-cache invalidation, dynamic-role TS surface on admin endpoints, role surfacing on user list responses. **Out:** dynamic-role creation/rename lifecycle (covered by #4557 rescoped tracker). Session cookie cache invalidation (cross-reference to `tracking: session cookie cache`). ## Resolution criteria - Super-admin authority is expressed and enforced across orgs. - Impersonation has a documented contract; `impersonatedBy` types align with the id strategy. - Team-role assignment has a stable API. - `hasPermission` returns the correct union across multiple role assignments. - A user-shaped role helper exists. - Built-in access-control rules are overridable. - The client invalidates the role cache on sign-out without a manual refetch. - Dynamic-role operations typecheck at every endpoint that accepts a role input, including invite. - User list responses carry org role where applicable. ## Related - Sibling: `tracking: admin/org dynamic-role lifecycle` (#4557 rescoped). - Cross-reference: `tracking: session cookie cache` for the role-cache invalidation path. - Prior closed context: #7315 (endpoint/docs mismatch).
GiteaMirror added the trackingenhancementorganization labels 2026-04-17 20:03:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#28627