Bernt Christian Egeland 1 месяц назад
Родитель
Сommit
b71cc06a96
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      src/features/team/Actions/deleteWorkshop.ts

+ 4 - 2
src/features/team/Actions/deleteWorkshop.ts

@@ -4,6 +4,7 @@ import { z } from "zod";
 import { cookies } from "next/headers";
 import { db } from "@/lib/db";
 import { withAuth } from "@/lib/with-auth";
+import { demoGuard } from "@/lib/demo";
 import { deleteOrganizationWithData } from "@/lib/delete-user-data";
 
 const deleteWorkshopSchema = z.object({ confirmName: z.string() });
@@ -18,8 +19,9 @@ const deleteWorkshopSchema = z.object({ confirmName: z.string() });
  */
 export async function deleteWorkshop(input: unknown) {
   return withAuth(async ({ userId, organizationId }) => {
-    // DEMO BRANCH: add demoGuard() here when merging - the shared demo user
-    // owns the demo org, so without it any visitor can delete the demo.
+    // The shared demo user owns the demo org, so without this guard any
+    // visitor could delete the demo.
+    demoGuard();
 
     const membership = await db.organizationMember.findFirst({
       where: { userId, organizationId },