From 3ef0ca580a84b708939bade4da0da3cf11561491 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Tue, 15 Nov 2022 13:13:09 +0100 Subject: [PATCH] Remove change request api protection (#2434) Remove change request api protection --- src/lib/services/feature-toggle-service.ts | 36 ---------------------- 1 file changed, 36 deletions(-) diff --git a/src/lib/services/feature-toggle-service.ts b/src/lib/services/feature-toggle-service.ts index a8eb57a7b8..e558b18e98 100644 --- a/src/lib/services/feature-toggle-service.ts +++ b/src/lib/services/feature-toggle-service.ts @@ -314,11 +314,6 @@ class FeatureToggleService { const { featureName, projectId, environment } = context; await this.validateFeatureContext(context); - if (await this.changeRequestsEnabled(projectId, environment)) { - throw new Error( - `Strategies can only be created through change requests for ${environment} environment`, - ); - } if (strategyConfig.constraints?.length > 0) { strategyConfig.constraints = await this.validateConstraints( strategyConfig.constraints, @@ -387,12 +382,6 @@ class FeatureToggleService { const existingStrategy = await this.featureStrategiesStore.get(id); this.validateFeatureStrategyContext(existingStrategy, context); - if (await this.changeRequestsEnabled(projectId, environment)) { - throw new Error( - `Strategies can only be updated through change requests for ${environment} environment`, - ); - } - if (existingStrategy.id === id) { if (updates.constraints?.length > 0) { updates.constraints = await this.validateConstraints( @@ -441,12 +430,6 @@ class FeatureToggleService { ): Promise> { const { projectId, environment, featureName } = context; - if (await this.changeRequestsEnabled(projectId, environment)) { - throw new Error( - `Strategies can only be updated through change requests for ${environment} environment`, - ); - } - const existingStrategy = await this.featureStrategiesStore.get(id); this.validateFeatureStrategyContext(existingStrategy, context); @@ -499,12 +482,6 @@ class FeatureToggleService { const { featureName, projectId, environment } = context; this.validateFeatureStrategyContext(existingStrategy, context); - if (await this.changeRequestsEnabled(projectId, environment)) { - throw new Error( - `Strategies can only deleted updated through change requests for ${environment} environment`, - ); - } - await this.featureStrategiesStore.delete(id); const tags = await this.tagStore.getAllTagsForFeature(featureName); @@ -926,12 +903,6 @@ class FeatureToggleService { createdBy: string, user?: User, ): Promise { - if (await this.changeRequestsEnabled(project, environment)) { - throw new Error( - `Features can only be updated through change requests for ${environment} environment`, - ); - } - const hasEnvironment = await this.featureEnvironmentStore.featureHasEnvironment( environment, @@ -1220,13 +1191,6 @@ class FeatureToggleService { }); return variableVariants.concat(fixedVariants); } - - changeRequestsEnabled( - project: string, - environment: string, - ): Promise { - return this.accessService.isChangeRequestsEnabled(project, environment); - } } export default FeatureToggleService;