diff --git a/packages/server/modules/gatekeeper/graph/resolvers/index.ts b/packages/server/modules/gatekeeper/graph/resolvers/index.ts index 61f4238ba..e46b7def1 100644 --- a/packages/server/modules/gatekeeper/graph/resolvers/index.ts +++ b/packages/server/modules/gatekeeper/graph/resolvers/index.ts @@ -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: diff --git a/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.spec.ts b/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.spec.ts index 9d4c8aa62..63474e832 100644 --- a/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.spec.ts +++ b/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.spec.ts @@ -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 @@ -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() }) }) diff --git a/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.ts b/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.ts index 7c36335c5..3ffbb8638 100644 --- a/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.ts +++ b/packages/shared/src/authz/policies/project/canReadAccIntegrationSettings.ts @@ -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()) diff --git a/packages/shared/src/workspaces/helpers/features.ts b/packages/shared/src/workspaces/helpers/features.ts index 5c3b9206d..3d66b8b94 100644 --- a/packages/shared/src/workspaces/helpers/features.ts +++ b/packages/shared/src/workspaces/helpers/features.ts @@ -24,7 +24,6 @@ export const WorkspacePlanFeatures = { 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 = ({ 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] : [])