fix: cannot delete resource when you are not on root team

This commit is contained in:
Andras Bacsai 2023-03-02 17:12:29 +01:00
parent 9dfde11e35
commit c0940f7a19

View File

@ -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) {