diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index d6d712083a..6731aea51c 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -348,13 +348,6 @@ export const getBackendUiStore = () => { const json = await response.json() return json }, - delete: async ({ role, resource, level }) => { - const response = await api.delete( - `/api/permission/${role}/${resource}/${level}` - ) - const json = await response.json() - return json - }, }, } diff --git a/packages/builder/src/components/backend/DataTable/popovers/ManageAccessPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/ManageAccessPopover.svelte index 8a1859a2d6..d8266b8f3b 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/ManageAccessPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/ManageAccessPopover.svelte @@ -4,42 +4,26 @@ import { Roles } from "constants/backend" import api from "builderStore/api" import { notifier } from "builderStore/store/notifications" - import { Button, Label, Select, Spacer } from "@budibase/bbui" + import { Button, Label, Input, Select, Spacer } from "@budibase/bbui" export let resourceId export let permissions - export let levels export let onClosed - // Draft level and role for editing - let level = levels[0] - let role = Roles.BASIC - - $: permissionKeys = Object.keys(permissions) - - async function addPermission() { + async function changePermission(level, role) { await backendUiStore.actions.permissions.save({ level, role, resource: resourceId, }) - // Show updated permissions in UI + // Show updated permissions in UI: REMOVE permissions = await backendUiStore.actions.permissions.forResource( resourceId ) - notifier.success("Access rule saved.") - - // Reset the draft permissions - level = levels[0] - role = Roles.BASIC - } - - async function deletePermission(level, role) { - await backendUiStore.actions.permissions.delete({ level, role, resourceId }) - delete permissions[role] - notifier.danger("Removed access rule.") - permissions = permissions + notifier.success("Updated permissions.") + // TODO: update permissions + // permissions[] } @@ -49,39 +33,24 @@