Add permissions to edit website.
parent
d93c2f9dd7
commit
f1db3d0451
|
@ -9,8 +9,9 @@ export default async (req, res) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
|
||||||
const { id: websiteUuid } = req.query;
|
const { id: websiteUuid } = req.query;
|
||||||
|
const { userId } = req.auth;
|
||||||
|
|
||||||
if (!(await allowQuery(req, TYPE_WEBSITE))) {
|
if (!userId || !(await allowQuery(req, TYPE_WEBSITE))) {
|
||||||
return unauthorized(res);
|
return unauthorized(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,10 +59,6 @@ export default async (req, res) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.method === 'DELETE') {
|
if (req.method === 'DELETE') {
|
||||||
if (!(await allowQuery(req, TYPE_WEBSITE))) {
|
|
||||||
return unauthorized(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
await deleteWebsite(websiteUuid);
|
await deleteWebsite(websiteUuid);
|
||||||
|
|
||||||
return ok(res);
|
return ok(res);
|
||||||
|
|
Loading…
Reference in New Issue