From 4fdb1d080d55fef54a51880288d10129b723a630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Fri, 14 May 2021 15:03:58 +0200 Subject: [PATCH] adds frontend for updating roles of a user --- .../portal/manage/users/[userId].svelte | 38 ++++++++++++++++++- .../users/_components/UpdateRolesModal.svelte | 35 +++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte 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 42585c471a..130f9b055b 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte @@ -10,14 +10,27 @@ Label, Input, Modal, + Table, ModalContent, notifications, } from "@budibase/bbui" import { fetchData } from "helpers" - import { users } from "stores/portal" + import { users, apps } from "stores/portal" + + import UpdateRolesModal from "./_components/UpdateRolesModal.svelte" export let userId let deleteUserModal + let editRolesModal + + const roleSchema = { + name: { displayName: "App" }, + roles: {}, + } + + // Here we need to merge the Apps list and the roles response to get something that makes sense for the table + $: appList = $apps.map(app => ({ ...app, roles: ["READ"] })) + let selectedApp const request = fetchData(`/api/admin/users/${userId}`) @@ -30,6 +43,11 @@ notifications.error("Failed to delete user.") } } + + async function openUpdateRolesModal({ detail }) { + selectedApp = detail + editRolesModal.show() + } @@ -64,6 +82,18 @@ +
+ Configure roles + + +
Delete user @@ -90,6 +120,9 @@ > + + +