From 27fc3a3c5e93d64c05af7dc3da82e4241e1a8a56 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 21 May 2021 16:30:37 +0100 Subject: [PATCH] Adding ability to create new admins. --- .../portal/manage/users/[userId].svelte | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) 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}