From 87606b9b9b4c6969d0eabf032f294c178450d8be Mon Sep 17 00:00:00 2001 From: Torben Haack Date: Fri, 11 Oct 2024 11:27:39 +0200 Subject: [PATCH] change permission error --- .../reservation-platform/src/server/actions/printJobs.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/reservation-platform/src/server/actions/printJobs.ts b/packages/reservation-platform/src/server/actions/printJobs.ts index 4c5e040..ad518dc 100644 --- a/packages/reservation-platform/src/server/actions/printJobs.ts +++ b/packages/reservation-platform/src/server/actions/printJobs.ts @@ -91,7 +91,7 @@ export async function abortPrintJob(jobId: string, reason: string) { // Check if user is the owner of the print job // biome-ignore lint/style/noNonNullAssertion: guard already checks against null - if (printJob.userId !== dbUser!.id || dbUser!.role !== UserRole.ADMIN) { + if (printJob.userId !== dbUser!.id && dbUser!.role !== UserRole.ADMIN) { throw new PermissionError(); } @@ -147,7 +147,7 @@ export async function earlyFinishPrintJob(jobId: string) { // Check if user is the owner of the print job // biome-ignore lint/style/noNonNullAssertion: guard already checks against null - if (printJob.userId !== dbUser!.id || dbUser!.role !== UserRole.ADMIN) { + if (printJob.userId !== dbUser!.id && dbUser!.role !== UserRole.ADMIN) { throw new PermissionError(); } @@ -201,7 +201,7 @@ export async function extendPrintJob(jobId: string, minutes: number, hours: numb // Check if user is the owner of the print job // biome-ignore lint/style/noNonNullAssertion: guard already checks against null - if (printJob.userId !== dbUser!.id || dbUser!.role !== UserRole.ADMIN) { + if (printJob.userId !== dbUser!.id && dbUser!.role !== UserRole.ADMIN) { throw new PermissionError(); } @@ -254,7 +254,7 @@ export async function updatePrintComments(jobId: string, comments: string) { // Check if user is the owner of the print job // biome-ignore lint/style/noNonNullAssertion: guard already checks against null - if (printJob.userId !== dbUser!.id || dbUser!.role !== UserRole.ADMIN) { + if (printJob.userId !== dbUser!.id && dbUser!.role !== UserRole.ADMIN) { throw new PermissionError(); }