Files
calendar/packages/types/next-auth.d.ts
T
60e0bbf4b7 feat: impersonation improvements (#13066)
* fix: rename checkPermission to be more fitting

* feat:return to user

* nits: cleanup plus comments

* cleanup

* test: Add e2e

* fix: fix fixtures

* nit: cleanup logs

* chore: move to impersonatedBy in session

* fix: can return to self

* Update apps/web/playwright/impersonation.e2e.ts

* fix: typecheck

---------

Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
2024-01-16 08:45:48 +00:00

58 lines
1.4 KiB
TypeScript

import type { User as PrismaUser, UserPermissionRole } from "@prisma/client";
import type { DefaultUser } from "next-auth";
declare module "next-auth" {
/**
* Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context
*/
interface Session {
hasValidLicense: boolean;
user: User;
}
interface User extends Omit<DefaultUser, "id"> {
id: PrismaUser["id"];
emailVerified?: PrismaUser["emailVerified"];
email_verified?: boolean;
impersonatedBy?: {
id: number;
role: PrismaUser["role"];
};
belongsToActiveTeam?: boolean;
org?: {
id: number;
name?: string;
slug: string;
fullDomain: string;
domainSuffix: string;
};
username?: PrismaUser["username"];
role?: PrismaUser["role"] | "INACTIVE_ADMIN";
locale?: string | null;
}
}
declare module "next-auth/jwt" {
interface JWT {
id?: string | number;
name?: string | null;
username?: string | null;
email?: string | null;
role?: UserPermissionRole | "INACTIVE_ADMIN" | null;
impersonatedBy?: {
id: number;
role: PrismaUser["role"];
};
belongsToActiveTeam?: boolean;
org?: {
id: number;
name?: string;
slug: string;
fullDomain: string;
domainSuffix: string;
};
organizationId?: number | null;
locale?: string;
}
}