From c0940f7a1914ce04fa47a9a8334a4daafa53ed43 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 2 Mar 2023 17:12:29 +0100 Subject: [PATCH] fix: cannot delete resource when you are not on root team --- apps/api/src/routes/api/v1/applications/handlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/routes/api/v1/applications/handlers.ts b/apps/api/src/routes/api/v1/applications/handlers.ts index 8d8f3ead2..886b7bc88 100644 --- a/apps/api/src/routes/api/v1/applications/handlers.ts +++ b/apps/api/src/routes/api/v1/applications/handlers.ts @@ -736,7 +736,7 @@ export async function deleteApplication( where: { id }, include: { destinationDocker: true, teams: true } }); - if (teamId !== '0' || !application.teams.some((team) => team.id === teamId)) { + if (teamId !== '0' && !application.teams.some((team) => team.id === teamId)) { throw { status: 403, message: 'You are not allowed to delete this application.' }; } if (application?.destinationDocker?.id && application.destinationDocker?.network) {