Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cursor review @greptile review |
PR SummaryHigh Risk Overview Updates session typing to include Written by Cursor Bugbot for commit 6f97d5a. This will update automatically on new commits. Configure here. |
Greptile SummaryThis PR adds an admin impersonation flow powered by better-auth's admin plugin. When an admin clicks "Impersonate" on a user in the admin panel, the session cookie is swapped to that user's identity and the page reloads. A persistent destructive banner (
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Admin clicks Impersonate button] --> B{Client-side role check}
B -- Not admin --> C[Show guard error message]
B -- Is admin --> D[Call impersonateUser mutation]
D --> E{API response}
E -- Error --> F[Show error, re-enable button]
E -- Success --> G[window.location.assign to workspace]
G --> H[Page reloads with target user session]
H --> I{session.impersonatedBy set?}
I -- Yes --> J[Render ImpersonationBanner]
I -- No --> K[No banner shown]
J --> L[Admin clicks Stop impersonating]
L --> M[Call stopImpersonating mutation]
M --> N{API response}
N -- Error --> O[Re-enable button]
N -- Success --> P[window.location.assign to workspace]
P --> Q[Page reloads with admin session]
Q --> K
|
apps/sim/app/workspace/[workspaceId]/settings/components/admin/admin.tsx
Show resolved
Hide resolved
* Allow admin users to assume user sessions * Add explicit role check * Fix lint * Remove admin panel when impersonating * Fix lint --------- Co-authored-by: Theodore Li <theo@sim.ai>
Summary
We need more visibility in how our users use mothership. Added an impersonate user flow to allow sim admins to view users' workspaces.
See: https://better-auth.com/docs/plugins/admin#impersonate-user
Type of Change
Testing
Checklist
Screenshots/Videos