v1.6.3: 403-Fehler bei Einträgen ohne created_by (NULL) beheben
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,8 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isAdmin = session.role?.includes('admin');
|
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) {
|
if (!isAdmin && !isCreator) {
|
||||||
return NextResponse.json({ error: 'Keine Berechtigung zum Ändern dieses Eintrags' }, { status: 403 });
|
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 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) {
|
if (!isAdmin && !isCreator) {
|
||||||
return NextResponse.json({ error: 'Keine Berechtigung zum Löschen dieses Eintrags' }, { status: 403 });
|
return NextResponse.json({ error: 'Keine Berechtigung zum Löschen dieses Eintrags' }, { status: 403 });
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "logbuch",
|
"name": "logbuch",
|
||||||
"version": "1.6.2",
|
"version": "1.6.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
Reference in New Issue
Block a user