From ce11a5a85292c242bab577f3796f8edff21185eb Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 29 Aug 2023 09:46:15 +0200 Subject: [PATCH 1/3] Lock feature based on ff --- .../buttons/grid/GridManageAccessButton.svelte | 6 +++++- packages/builder/src/stores/portal/licensing.js | 4 ++++ packages/frontend-core/src/constants.js | 12 +----------- packages/types/src/sdk/licensing/feature.ts | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte index 0cd008bab1..a7f18464ef 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte @@ -1,4 +1,5 @@ - + diff --git a/packages/builder/src/stores/portal/licensing.js b/packages/builder/src/stores/portal/licensing.js index 4a59f29f52..eb9c9abe93 100644 --- a/packages/builder/src/stores/portal/licensing.js +++ b/packages/builder/src/stores/portal/licensing.js @@ -125,6 +125,9 @@ export const createLicensingStore = () => { const syncAutomationsEnabled = license.features.includes( Constants.Features.SYNC_AUTOMATIONS ) + const isViewPermissionsEnabled = license.features.includes( + Constants.Features.VIEW_PERMISSIONS + ) store.update(state => { return { ...state, @@ -140,6 +143,7 @@ export const createLicensingStore = () => { auditLogsEnabled, enforceableSSO, syncAutomationsEnabled, + isViewPermissionsEnabled, } }) }, diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index 0497a392f3..93a857ef9d 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -2,6 +2,7 @@ * Operator options for lucene queries */ export { OperatorOptions, SqlNumberTypeRangeMap } from "@budibase/shared-core" +export { Feature as Features } from "@budibase/types" // Cookie names export const Cookies = { @@ -62,17 +63,6 @@ export const PlanType = { */ export const ApiVersion = "1" -export const Features = { - USER_GROUPS: "userGroups", - BACKUPS: "appBackups", - ENVIRONMENT_VARIABLES: "environmentVariables", - AUDIT_LOGS: "auditLogs", - ENFORCEABLE_SSO: "enforceableSSO", - BRANDING: "branding", - SCIM: "scim", - SYNC_AUTOMATIONS: "syncAutomations", -} - // Role IDs export const Roles = { ADMIN: "ADMIN", diff --git a/packages/types/src/sdk/licensing/feature.ts b/packages/types/src/sdk/licensing/feature.ts index 218c2c5429..bd3a6583bf 100644 --- a/packages/types/src/sdk/licensing/feature.ts +++ b/packages/types/src/sdk/licensing/feature.ts @@ -12,7 +12,7 @@ export enum Feature { APP_BUILDERS = "appBuilders", OFFLINE = "offline", USER_ROLE_PUBLIC_API = "userRolePublicApi", - VIEW_PERMISSIONS = "viewPermission", + VIEW_PERMISSIONS = "viewPermissions", } export type PlanFeatures = { [key in PlanType]: Feature[] | undefined } From 12b869d7d14270c0ad8ab24595b824163bb788e5 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 29 Aug 2023 10:57:32 +0200 Subject: [PATCH 2/3] Display required license --- .../buttons/ManageAccessButton.svelte | 2 + .../grid/GridManageAccessButton.svelte | 16 ++++-- .../DataTable/modals/ManageAccessModal.svelte | 53 +++++++++++++------ 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte index bc8e0c5318..f6a74784fa 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte @@ -5,6 +5,7 @@ export let resourceId export let disabled = false + export let requiresLicence let modal let resourcePermissions @@ -21,6 +22,7 @@ diff --git a/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte index a7f18464ef..d6a2c5dee2 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/grid/GridManageAccessButton.svelte @@ -1,5 +1,5 @@ - + diff --git a/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte b/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte index aa6dbc93e0..678fb3b1c5 100644 --- a/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/ManageAccessModal.svelte @@ -7,11 +7,14 @@ notifications, Body, ModalContent, + Tags, + Tag, } from "@budibase/bbui" import { capitalise } from "helpers" export let resourceId export let permissions + export let requiresLicence async function changePermission(level, role) { try { @@ -30,22 +33,36 @@ } - - Specify the minimum access level role for this data. -
- - - {#each Object.keys(permissions) as level} - - +