diff --git a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte index bbd2e079e0..9ad2d1c09f 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte @@ -17,7 +17,7 @@ notifications, } from "@budibase/bbui" import { fetchData } from "helpers" - import { users } from "stores/portal" + import { users, auth } from "stores/portal" import TagsRenderer from "./_components/TagsTableRenderer.svelte" import UpdateRolesModal from "./_components/UpdateRolesModal.svelte" @@ -56,13 +56,21 @@ let toggleDisabled = false - async function toggleBuilderAccess({ detail }) { + async function toggleFlag(flagName, detail) { toggleDisabled = true - await users.save({ ...$userFetch?.data, builder: { global: detail } }) + await users.save({ ...$userFetch?.data, [flagName]: { global: detail } }) await userFetch.refresh() toggleDisabled = false } + async function toggleBuilderAccess({ detail }) { + return toggleFlag("builder", detail) + } + + async function toggleAdminAccess({ detail }) { + return toggleFlag("admin", detail) + } + async function openUpdateRolesModal({ detail }) { selectedApp = detail editRolesModal.show() @@ -107,15 +115,27 @@ -
- - -
+ + {#if userId !== $auth.user._id} +
+ + +
+
+ + +
+ {/if}