diff --git a/frontend/src/lib/components/ModelTable/ModelTable.svelte b/frontend/src/lib/components/ModelTable/ModelTable.svelte index 208dc108a8..7dea3386ed 100644 --- a/frontend/src/lib/components/ModelTable/ModelTable.svelte +++ b/frontend/src/lib/components/ModelTable/ModelTable.svelte @@ -250,6 +250,7 @@ {row} hasBody={$$slots.actionsBody} {identifierField} + preventDelete={row.meta.preventDelete ?? false} > {#if $$slots.actionsHead} diff --git a/frontend/src/lib/components/TableRowActions/TableRowActions.svelte b/frontend/src/lib/components/TableRowActions/TableRowActions.svelte index bbd2a0c729..3e7513fa77 100644 --- a/frontend/src/lib/components/TableRowActions/TableRowActions.svelte +++ b/frontend/src/lib/components/TableRowActions/TableRowActions.svelte @@ -18,6 +18,7 @@ export let deleteForm: SuperValidated | undefined; export let URLModel: urlModel | string | undefined; export let identifierField: string = 'id'; + export let preventDelete = false; export let hasBody = false; @@ -46,7 +47,8 @@ } const user = $page.data.user; - const canDeleteObject: boolean = Object.hasOwn(user.permissions, `delete_${model?.name}`); + const canDeleteObject: boolean = + Object.hasOwn(user.permissions, `delete_${model?.name}`) && !preventDelete; const canEditObject: boolean = Object.hasOwn(user.permissions, `change_${model?.name}`); $: displayDetail = detailURL;