Tighten API access checks by website section and share permissions

This commit is contained in:
Mike Cao committed 2026-06-02 15:29:23 -07:00
1 parent 8bc49a29e3
commit ade0819be1
69 files changed
+303 -188

No files matched your search

@@ -3,7 +3,7 @@ import { uuid } from '@/lib/crypto';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { searchParams, segmentParamSchema, segmentTypeParam } from '@/lib/schema';
import { canUpdateWebsite, canViewWebsite } from '@/permissions';
import { canUpdateWebsite, canViewAuthenticatedWebsite } from '@/permissions';
import { createSegment, getWebsiteSegments } from '@/queries/prisma';
export async function GET(
@@ -24,7 +24,7 @@ export async function GET(
const { websiteId } = await params;
const { type } = query;
if (websiteId && !(await canViewWebsite(auth, websiteId))) {
if (websiteId && !(await canViewAuthenticatedWebsite(auth, websiteId))) {
return unauthorized();
}