Lock feature based on ff

This commit is contained in:
Adria Navarro 2023-08-29 09:46:15 +02:00
parent 33ed4e1cbf
commit ce11a5a852
4 changed files with 11 additions and 13 deletions

View File

@ -1,4 +1,5 @@
<script>
import { licensing } from "stores/portal"
import ManageAccessButton from "../ManageAccessButton.svelte"
import { getContext } from "svelte"
@ -12,6 +13,9 @@
}
return datasource.type === "table" ? datasource.tableId : datasource.id
}
$: disabled =
$datasource.type === "viewV2" && !$licensing.isViewPermissionsEnabled
</script>
<ManageAccessButton {resourceId} />
<ManageAccessButton {resourceId} {disabled} />

View File

@ -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,
}
})
},

View File

@ -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",

View File

@ -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 }