Team Impersonation (#3450)

* Team Impersonation

* Refactor - Disable Imeprsonate button

* Change copy

* Add .env toggle

* Fix eslint

* Update role selection

Co-authored-by: Omar López <[email protected]>

* New 'admin' seed user, improve flow ImpersonationProvider

* Fix impersonation string

* Adds fullstop

Co-authored-by: Sean Brydon <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2022-07-21 17:02:20 +00:00
1 parent 471420c1d4
commit d3fcb8bf7d
11 files changed
+305 -42

No files matched your search

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Membership" ADD COLUMN "disableImpersonation" BOOLEAN NOT NULL DEFAULT false;
+7 -6
View File
@@ -206,12 +206,13 @@ enum MembershipRole {
}
model Membership {
teamId Int
userId Int
accepted Boolean @default(false)
role MembershipRole
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
teamId Int
userId Int
accepted Boolean @default(false)
role MembershipRole
team Team @relation(fields: [teamId], references: [id])
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
disableImpersonation Boolean @default(false)
@@id([userId, teamId])
}
+15 -1
View File
@@ -1,4 +1,4 @@
import { BookingStatus, MembershipRole, Prisma, UserPlan } from "@prisma/client";
import { BookingStatus, MembershipRole, Prisma, UserPermissionRole, UserPlan } from "@prisma/client";
import { uuid } from "short-uuid";
import dayjs from "@calcom/dayjs";
@@ -18,6 +18,7 @@ async function createUserAndEventType(opts: {
name: string;
completedOnboarding?: boolean;
timeZone?: string;
role?: UserPermissionRole;
};
eventTypes: Array<
Prisma.EventTypeCreateInput & {
@@ -468,6 +469,18 @@ async function main() {
eventTypes: [],
});
await createUserAndEventType({
user: {
email: "[email protected]",
password: "admin",
username: "admin",
name: "Admin Example",
plan: "PRO",
role: "ADMIN",
},
eventTypes: [],
});
const pro2UserTeam = await createUserAndEventType({
user: {
email: "[email protected]",
@@ -536,6 +549,7 @@ async function main() {
{
id: pro2UserTeam.id,
username: pro2UserTeam.name || "Unknown",
role: "MEMBER",
},
{
id: pro3UserTeam.id,