mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
add permission to create report.
This commit is contained in:
parent
2832ff9622
commit
fd1b9ff7b4
@ -6,7 +6,7 @@ import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { createReport, getReports } from 'queries';
|
||||
import * as yup from 'yup';
|
||||
import { canViewTeam, canViewWebsite } from 'lib/auth';
|
||||
import { canUpdateWebsite, canViewTeam, canViewWebsite } from 'lib/auth';
|
||||
|
||||
export interface ReportRequestBody {
|
||||
websiteId: string;
|
||||
@ -89,6 +89,10 @@ export default async (
|
||||
if (req.method === 'POST') {
|
||||
const { websiteId, type, name, description, parameters } = req.body;
|
||||
|
||||
if (!(await canUpdateWebsite(req.auth, websiteId))) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const result = await createReport({
|
||||
id: uuid(),
|
||||
userId,
|
||||
|
Loading…
Reference in New Issue
Block a user