From a8ff2da7689b310ff8ad359b72f2b41e1cfd01f8 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 1 Aug 2023 11:30:04 +0100 Subject: [PATCH] Removing isAdmin and isBuilder flags from the auth store, using SDK only. --- packages/builder/src/pages/builder/apps/index.svelte | 2 +- .../builder/portal/_components/UpgradeButton.svelte | 3 ++- packages/builder/src/pages/builder/portal/_layout.svelte | 4 ++-- .../src/pages/builder/portal/account/upgrade.svelte | 3 ++- .../src/pages/builder/portal/account/usage.svelte | 4 +++- .../src/pages/builder/portal/settings/branding.svelte | 5 +++-- .../src/pages/builder/portal/settings/diagnostics.svelte | 3 ++- .../pages/builder/portal/settings/organisation.svelte | 5 +++-- .../src/pages/builder/portal/settings/version.svelte | 5 +++-- .../pages/builder/portal/users/groups/[groupId].svelte | 3 ++- .../users/groups/_components/EditUserPicker.svelte | 3 ++- .../portal/users/groups/_components/GroupUsers.svelte | 3 ++- .../groups/_components/RemoveUserTableRenderer.svelte | 7 ++++++- .../src/pages/builder/portal/users/groups/index.svelte | 3 ++- .../src/pages/builder/portal/users/users/[userId].svelte | 4 ++-- .../users/_components/RemoveGroupTableRenderer.svelte | 7 ++++++- .../src/pages/builder/portal/users/users/index.svelte | 3 ++- packages/builder/src/stores/portal/auth.js | 9 --------- 18 files changed, 45 insertions(+), 31 deletions(-) diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index f6c5df17c9..6b74694c00 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -107,7 +107,7 @@ > Update password - {#if $auth.isBuilder} + {#if sdk.users.hasBuilderPermissions($auth.user)} $goto("../portal")} diff --git a/packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte b/packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte index b67693a552..b12efd6f03 100644 --- a/packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte +++ b/packages/builder/src/pages/builder/portal/_components/UpgradeButton.svelte @@ -3,6 +3,7 @@ import { goto } from "@roxi/routify" import { auth, admin, licensing } from "stores/portal" import { isEnabled, TENANT_FEATURE_FLAGS } from "helpers/featureFlags" + import { sdk } from "@budibase/shared-core" {#if isEnabled(TENANT_FEATURE_FLAGS.LICENSING) && !$licensing.isEnterprisePlan} @@ -17,7 +18,7 @@ > Upgrade - {:else if !$admin.cloud && $auth.isAdmin} + {:else if !$admin.cloud && sdk.users.isAdmin($auth.user)}