Fixed components build. Renamed validations to permissions.

This commit is contained in:
Mike Cao 2025-09-02 09:23:35 -07:00
parent f0ec24e8f5
commit c916e4ff9c
80 changed files with 99 additions and 373 deletions

View file

@ -1,27 +0,0 @@
import { Auth } from '@/lib/types';
import { Report } from '@/generated/prisma/client';
import { canViewWebsite } from './website';
export async function canViewReport(auth: Auth, report: Report) {
if (auth.user.isAdmin) {
return true;
}
if (auth.user.id == report.userId) {
return true;
}
return !!(await canViewWebsite(auth, report.websiteId));
}
export async function canUpdateReport({ user }: Auth, report: Report) {
if (user.isAdmin) {
return true;
}
return user.id == report.userId;
}
export async function canDeleteReport(auth: Auth, report: Report) {
return canUpdateReport(auth, report);
}