fix sharetoken permissions for pixels,links,boards, and failed routes

This commit is contained in:
Francis Cao committed 2026-06-08 19:16:01 -07:00
1 parent d2eafd68f7
commit 2df051e216
35 files changed
+308 -145

No files matched your search

@@ -1,6 +1,6 @@
import { parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { canViewAuthenticatedWebsite } from '@/permissions';
import { canViewWebsiteSection } from '@/permissions';
import { getEventDataById } from '@/queries/sql/events/getEventDataById';
export async function GET(
@@ -15,7 +15,7 @@ export async function GET(
const { websiteId, eventId } = await params;
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
if (!(await canViewWebsiteSection(auth, websiteId, 'events'))) {
return unauthorized();
}
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { filterParams } from '@/lib/schema';
import { canViewAuthenticatedWebsite } from '@/permissions';
import { canViewWebsiteSection } from '@/permissions';
import { getEventDataEvents } from '@/queries/sql/events/getEventDataEvents';
export async function GET(
@@ -23,7 +23,7 @@ export async function GET(
const { websiteId } = await params;
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
if (!(await canViewWebsiteSection(auth, websiteId, 'events'))) {
return unauthorized();
}
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { filterParams } from '@/lib/schema';
import { canViewAuthenticatedWebsite } from '@/permissions';
import { canViewWebsiteSection } from '@/permissions';
import { getEventDataFields } from '@/queries/sql';
export async function GET(
@@ -23,7 +23,7 @@ export async function GET(
const { websiteId } = await params;
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
if (!(await canViewWebsiteSection(auth, websiteId, 'events'))) {
return unauthorized();
}
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { filterParams } from '@/lib/schema';
import { canViewAuthenticatedWebsite } from '@/permissions';
import { canViewWebsiteSection } from '@/permissions';
import { getEventDataProperties } from '@/queries/sql';
export async function GET(
@@ -23,7 +23,7 @@ export async function GET(
const { websiteId } = await params;
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
if (!(await canViewWebsiteSection(auth, websiteId, 'events'))) {
return unauthorized();
}
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { filterParams, pagingParams } from '@/lib/schema';
import { canViewAuthenticatedWebsite } from '@/permissions';
import { canViewWebsiteSection } from '@/permissions';
import { getEventData } from '@/queries/sql/events/getEventData';
export async function GET(
@@ -24,7 +24,7 @@ export async function GET(
const { websiteId } = await params;
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
if (!(await canViewWebsiteSection(auth, websiteId, 'events'))) {
return unauthorized();
}
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { filterParams } from '@/lib/schema';
import { canViewAuthenticatedWebsite } from '@/permissions';
import { canViewWebsiteSection } from '@/permissions';
import { getEventDataStats } from '@/queries/sql';
export async function GET(
@@ -23,7 +23,7 @@ export async function GET(
const { websiteId } = await params;
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
if (!(await canViewWebsiteSection(auth, websiteId, 'events'))) {
return unauthorized();
}
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { filterParams } from '@/lib/schema';
import { canViewAuthenticatedWebsite } from '@/permissions';
import { canViewWebsiteSection } from '@/permissions';
import { getEventDataValues } from '@/queries/sql';
export async function GET(
@@ -26,7 +26,7 @@ export async function GET(
const { websiteId } = await params;
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
if (!(await canViewWebsiteSection(auth, websiteId, 'events'))) {
return unauthorized();
}