From 16cb6d556f68442a716cbecf97de0f18a1c69e92 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 2 Aug 2022 14:35:32 +0100 Subject: [PATCH] Prevent deleting yourself from users list page --- .../src/pages/builder/portal/manage/users/index.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/builder/src/pages/builder/portal/manage/users/index.svelte b/packages/builder/src/pages/builder/portal/manage/users/index.svelte index d18881d1bb..b6cac9ece3 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/index.svelte @@ -28,6 +28,7 @@ import ImportUsersModal from "./_components/ImportUsersModal.svelte" import { createPaginationStore } from "helpers/pagination" import { Constants } from "@budibase/frontend-core" + import { get } from "svelte/store" const accessTypes = [ { @@ -198,6 +199,10 @@ const deleteRows = async () => { try { let ids = selectedRows.map(user => user._id) + if (ids.includes(get(auth).user._id)) { + notifications.error("You cannot delete yourself") + return + } await users.bulkDelete(ids) notifications.success(`Successfully deleted ${selectedRows.length} rows`) selectedRows = []