Prevent deleting yourself from users list page
This commit is contained in:
parent
3c1d2bd7cf
commit
16cb6d556f
|
@ -28,6 +28,7 @@
|
||||||
import ImportUsersModal from "./_components/ImportUsersModal.svelte"
|
import ImportUsersModal from "./_components/ImportUsersModal.svelte"
|
||||||
import { createPaginationStore } from "helpers/pagination"
|
import { createPaginationStore } from "helpers/pagination"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
|
import { get } from "svelte/store"
|
||||||
|
|
||||||
const accessTypes = [
|
const accessTypes = [
|
||||||
{
|
{
|
||||||
|
@ -198,6 +199,10 @@
|
||||||
const deleteRows = async () => {
|
const deleteRows = async () => {
|
||||||
try {
|
try {
|
||||||
let ids = selectedRows.map(user => user._id)
|
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)
|
await users.bulkDelete(ids)
|
||||||
notifications.success(`Successfully deleted ${selectedRows.length} rows`)
|
notifications.success(`Successfully deleted ${selectedRows.length} rows`)
|
||||||
selectedRows = []
|
selectedRows = []
|
||||||
|
|
Loading…
Reference in New Issue