feat: allow only team users to record daily meetings (#8799)

This commit is contained in:
Jon@1599 authored and GitHub committed 2023-05-10 08:28:49 +00:00
1 parent cc3be0a6ac
commit 2e686d03fa
1 file changed
+12 -2
@@ -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: {