mirror of
https://github.com/diced/zipline.git
synced 2025-12-05 20:40:12 -08:00
fix: editing files that are owned by current user
This commit is contained in:
@@ -39,7 +39,8 @@ export default fastifyPlugin(
|
||||
});
|
||||
if (!file) return res.notFound();
|
||||
|
||||
if (!canInteract(req.user.role, file.User?.role ?? 'USER')) return res.notFound();
|
||||
if (req.user.id !== file.User?.id && !canInteract(req.user.role, file.User?.role ?? 'USER'))
|
||||
return res.notFound();
|
||||
|
||||
return res.send(file);
|
||||
});
|
||||
@@ -56,7 +57,8 @@ export default fastifyPlugin(
|
||||
});
|
||||
if (!file) return res.notFound();
|
||||
|
||||
if (!canInteract(req.user.role, file.User?.role ?? 'USER')) return res.notFound();
|
||||
if (req.user.id !== file.User?.id && !canInteract(req.user.role, file.User?.role ?? 'USER'))
|
||||
return res.notFound();
|
||||
|
||||
const data: Prisma.FileUpdateInput = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user