fix: only check event type ownership if not admin
parent
514a98f9e0
commit
d8d0d42374
|
@ -27,10 +27,9 @@ export async function eventTypeById(
|
||||||
select: { eventTypes: true },
|
select: { eventTypes: true },
|
||||||
});
|
});
|
||||||
const userEventTypes = data.eventTypes.map((eventType) => eventType.id);
|
const userEventTypes = data.eventTypes.map((eventType) => eventType.id);
|
||||||
|
if (!isAdmin) {
|
||||||
if (!isAdmin || !userEventTypes.includes(safeQuery.data.id))
|
if (!userEventTypes.includes(safeQuery.data.id)) res.status(401).json({ message: "Unauthorized" });
|
||||||
res.status(401).json({ message: "Unauthorized" });
|
} else {
|
||||||
else {
|
|
||||||
switch (method) {
|
switch (method) {
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
|
|
Loading…
Reference in New Issue