diff --git a/app/api/logbuch/[id]/route.ts b/app/api/logbuch/[id]/route.ts index 1f4fc18..3dcb75b 100644 --- a/app/api/logbuch/[id]/route.ts +++ b/app/api/logbuch/[id]/route.ts @@ -18,7 +18,8 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{ } const isAdmin = session.role?.includes('admin'); - const isCreator = existingRows[0].created_by === session.beoId; + const createdBy = existingRows[0].created_by; + const isCreator = createdBy === null || createdBy === session.beoId; if (!isAdmin && !isCreator) { return NextResponse.json({ error: 'Keine Berechtigung zum Ändern dieses Eintrags' }, { status: 403 }); @@ -90,7 +91,8 @@ export async function DELETE(_request: NextRequest, { params }: { params: Promis } const isAdmin = session.role?.includes('admin'); - const isCreator = existingRows[0].created_by === session.beoId; + const createdBy = existingRows[0].created_by; + const isCreator = createdBy === null || createdBy === session.beoId; if (!isAdmin && !isCreator) { return NextResponse.json({ error: 'Keine Berechtigung zum Löschen dieses Eintrags' }, { status: 403 }); diff --git a/package.json b/package.json index 2891e35..9414232 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "logbuch", - "version": "1.6.2", + "version": "1.6.3", "private": true, "scripts": { "dev": "next dev",