Tighten API access checks by website section and share permissions
This commit is contained in:
1 parent
8bc49a29e3
commit
ade0819be1
69 files changed
+303
-188
No files matched your search
@@ -2,7 +2,7 @@ import { startOfMinute, subMinutes } from 'date-fns';
|
||||
import { REALTIME_RANGE } from '@/lib/constants';
|
||||
import { getQueryFilters, parseRequest } from '@/lib/request';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { canViewWebsite } from '@/permissions';
|
||||
import { canViewWebsiteSection } from '@/permissions';
|
||||
import { getRealtimeData } from '@/queries/sql';
|
||||
|
||||
export async function GET(
|
||||
@@ -17,7 +17,7 @@ export async function GET(
|
||||
|
||||
const { websiteId } = await params;
|
||||
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
if (!(await canViewWebsiteSection(auth, websiteId, 'realtime'))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user