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
@@ -1,7 +1,7 @@
|
||||
import { getQueryFilters, parseRequest, setWebsiteDate } from '@/lib/request';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { reportResultSchema } from '@/lib/schema';
|
||||
import { canViewWebsite } from '@/permissions';
|
||||
import { canViewWebsiteSection } from '@/permissions';
|
||||
import { getRetention, type RetentionParameters } from '@/queries/sql';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
@@ -13,7 +13,7 @@ export async function POST(request: Request) {
|
||||
|
||||
const { websiteId } = body;
|
||||
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
if (!(await canViewWebsiteSection(auth, websiteId, 'retention'))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user