From 2e686d03fa5b0b4ed1a532159b234644a69657b0 Mon Sep 17 00:00:00 2001 From: "Jon@1599" <55296387+Jonathan1599@users.noreply.github.com> Date: Wed, 10 May 2023 13:58:49 +0530 Subject: [PATCH] feat: allow only team users to record daily meetings (#8799) --- .../app-store/dailyvideo/lib/VideoApiAdapter.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts b/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts index 6e7dbe2d63..a7076b832f 100644 --- a/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts +++ b/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts @@ -1,6 +1,7 @@ import { z } from "zod"; import { handleErrorsJson } from "@calcom/lib/errors"; +import { prisma } from "@calcom/prisma"; import type { GetRecordingsResponseSchema, GetAccessLinkResponseSchema } from "@calcom/prisma/zod-utils"; import { getRecordingsResponseSchema, getAccessLinkResponseSchema } from "@calcom/prisma/zod-utils"; import type { CalendarEvent } from "@calcom/types/Calendar"; @@ -108,8 +109,17 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => { // added a 1 hour buffer for room expiration const exp = Math.round(new Date(event.endTime).getTime() / 1000) + 60 * 60; const { scale_plan: scalePlan } = await getDailyAppKeys(); - - if (scalePlan === "true") { + const hasTeamPlan = await prisma.membership.findFirst({ + where: { + userId: event.organizer.id, + team: { + slug: { + not: null, + }, + }, + }, + }); + if (scalePlan === "true" && !!hasTeamPlan === true) { return { privacy: "public", properties: {