feat: impersonation improvements#13066
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Ignored Deployments
|
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
| <a className="border-b border-b-black" href="/auth/logout"> | ||
| {t("impersonating_stop_instructions")} | ||
| </a> | ||
| canReturnToSelf ? ( |
There was a problem hiding this comment.
Validation also happens on BE just easier to handle this signout functionality here than within the custom provider from next-auth
| export function checkUserIdentifier(creds: Partial<Credentials>) { | ||
| if (!creds?.username) throw new Error("User identifier must be present"); | ||
| if (!creds?.username) { | ||
| if (creds?.returnToId) return; |
There was a problem hiding this comment.
If there is no username and a returnToId -> we dont need to throw here
|
|
||
| if (returningUser) { | ||
| // Skip for none org users | ||
| if (returningUser.role !== "ADMIN" && !returningUser.organizationId) return; |
There was a problem hiding this comment.
Ensure this can only be used by admins and if you are in an org
| impersonatedBy?: { | ||
| id: number; | ||
| role: PrismaUser["role"]; | ||
| }; |
There was a problem hiding this comment.
Easier to handle FE permissions when in impersonation
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
Wow this looks like a way snappier experience! I love it |

What does this PR do?
Fixes SAL-77
Loom Video: https://www.loom.com/share/9f69dec44bb74677838038bd4982bf7f
Requirement/Documentation
Type of change
How should this be tested?