move acc integration to a per workspace feature access (#5308)
* feat(workspaces): move acc integration to a per workspace feature access item * chore(workspaces): remove leftover todo
This commit is contained in:
@@ -130,7 +130,7 @@ export default FF_GATEKEEPER_MODULE_ENABLED
|
||||
case 'dashboards':
|
||||
return WorkspaceFeatureFlags.dashboards
|
||||
case 'accIntegration':
|
||||
// TODO: move this to be a feature flag, once the feature flags have rolled out.
|
||||
return WorkspaceFeatureFlags.accIntegration
|
||||
case WorkspacePlanFeatures.DomainSecurity:
|
||||
case WorkspacePlanFeatures.ExclusiveMembership:
|
||||
case WorkspacePlanFeatures.HideSpeckleBranding:
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
ProjectNoAccessError,
|
||||
WorkspacePlanNoFeatureAccessError
|
||||
} from '../../domain/authErrors.js'
|
||||
import { WorkspaceFeatureFlags } from '../../../workspaces/index.js'
|
||||
import { WorkspaceFeatureFlags, WorkspacePlans } from '../../../workspaces/index.js'
|
||||
|
||||
const buildSUT = (
|
||||
overrides?: OverridesOf<typeof canReadAccIntegrationSettingsPolicy>
|
||||
@@ -97,13 +97,13 @@ describe('canReadAccIntegrationSettings returns a function, that', () => {
|
||||
code: WorkspacePlanNoFeatureAccessError.code
|
||||
})
|
||||
})
|
||||
it('requires the workspace plan to have access to the ACC integration feature', async () => {
|
||||
it('requires the workspace plan to have access to the ACC integration feature flag', async () => {
|
||||
const result = await buildSUT({
|
||||
getWorkspacePlan: async () => {
|
||||
return {
|
||||
status: 'valid',
|
||||
workspaceId: cryptoRandomString({ length: 9 }),
|
||||
name: 'free',
|
||||
name: WorkspacePlans.Enterprise,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
featureFlags: WorkspaceFeatureFlags.none
|
||||
@@ -115,8 +115,19 @@ describe('canReadAccIntegrationSettings returns a function, that', () => {
|
||||
code: WorkspacePlanNoFeatureAccessError.code
|
||||
})
|
||||
})
|
||||
it('allows enterprise plans to access the ACC integration feature', async () => {
|
||||
const result = await buildSUT({})(buildArgs())
|
||||
it('allows plans with the feature flag on, to access the ACC integration feature', async () => {
|
||||
const result = await buildSUT({
|
||||
getWorkspacePlan: async () => {
|
||||
return {
|
||||
status: 'valid',
|
||||
workspaceId: cryptoRandomString({ length: 9 }),
|
||||
name: WorkspacePlans.Free,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
featureFlags: WorkspaceFeatureFlags.accIntegration
|
||||
}
|
||||
}
|
||||
})(buildArgs())
|
||||
expect(result).toBeAuthOKResult()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -17,8 +17,8 @@ import { Loaders } from '../../domain/loaders.js'
|
||||
import { AuthPolicy } from '../../domain/policies.js'
|
||||
import { ensureImplicitProjectMemberWithReadAccessFragment } from '../../fragments/projects.js'
|
||||
import {
|
||||
WorkspacePlanFeatures,
|
||||
workspacePlanHasAccessToFeature
|
||||
isWorkspaceFeatureFlagOn,
|
||||
WorkspaceFeatureFlags
|
||||
} from '../../../workspaces/index.js'
|
||||
|
||||
type PolicyLoaderKeys =
|
||||
@@ -77,12 +77,9 @@ export const canReadAccIntegrationSettingsPolicy: AuthPolicy<
|
||||
workspaceId: project.workspaceId
|
||||
})
|
||||
if (!workspacePlan) return err(new WorkspacePlanNoFeatureAccessError())
|
||||
const canUseFeature = workspacePlanHasAccessToFeature({
|
||||
plan: workspacePlan.name,
|
||||
feature: WorkspacePlanFeatures.AccIntegration,
|
||||
featureFlags: {
|
||||
FF_ACC_INTEGRATION_ENABLED: true
|
||||
}
|
||||
const canUseFeature = isWorkspaceFeatureFlagOn({
|
||||
workspaceFeatureFlags: workspacePlan.featureFlags,
|
||||
feature: WorkspaceFeatureFlags.accIntegration
|
||||
})
|
||||
if (!canUseFeature) return err(new WorkspacePlanNoFeatureAccessError())
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ export const WorkspacePlanFeatures = <const>{
|
||||
HideSpeckleBranding: 'hideSpeckleBranding',
|
||||
ExclusiveMembership: 'exclusiveMembership',
|
||||
EmbedPrivateProjects: 'embedPrivateProjects',
|
||||
AccIntegration: 'accIntegration', // TODO: this should be moved to a workspace addon
|
||||
SavedViews: 'savedViews'
|
||||
}
|
||||
|
||||
@@ -90,10 +89,6 @@ export const WorkspacePlanFeaturesMetadata = (<const>{
|
||||
displayName: 'Embed private projects',
|
||||
description: 'Embed projects with visibility set to private or workspace'
|
||||
},
|
||||
[WorkspacePlanFeatures.AccIntegration]: {
|
||||
displayName: 'ACC connector',
|
||||
description: 'Configure automatic import of ACC assets into workspace projects'
|
||||
},
|
||||
[WorkspacePlanFeatures.SavedViews]: {
|
||||
displayName: 'Saved views',
|
||||
description: 'Create and share saved views of your models'
|
||||
@@ -214,9 +209,6 @@ export const WorkspaceUnpaidPlanConfigs: (params: {
|
||||
WorkspacePlanFeatures.CustomDataRegion,
|
||||
WorkspacePlanFeatures.HideSpeckleBranding,
|
||||
WorkspacePlanFeatures.ExclusiveMembership,
|
||||
...(params.featureFlags?.FF_ACC_INTEGRATION_ENABLED
|
||||
? [WorkspacePlanFeatures.AccIntegration]
|
||||
: []),
|
||||
...(params.featureFlags?.FF_SAVED_VIEWS_ENABLED
|
||||
? [WorkspacePlanFeatures.SavedViews]
|
||||
: [])
|
||||
@@ -232,9 +224,6 @@ export const WorkspaceUnpaidPlanConfigs: (params: {
|
||||
WorkspacePlanFeatures.CustomDataRegion,
|
||||
WorkspacePlanFeatures.HideSpeckleBranding,
|
||||
WorkspacePlanFeatures.ExclusiveMembership,
|
||||
...(params.featureFlags?.FF_ACC_INTEGRATION_ENABLED
|
||||
? [WorkspacePlanFeatures.AccIntegration]
|
||||
: []),
|
||||
...(params.featureFlags?.FF_SAVED_VIEWS_ENABLED
|
||||
? [WorkspacePlanFeatures.SavedViews]
|
||||
: [])
|
||||
|
||||
Reference in New Issue
Block a user