mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-09 01:17:06 +02:00
Remove change request api protection (#2434)
Remove change request api protection
This commit is contained in:
parent
e32b6ad576
commit
3ef0ca580a
@ -314,11 +314,6 @@ class FeatureToggleService {
|
|||||||
const { featureName, projectId, environment } = context;
|
const { featureName, projectId, environment } = context;
|
||||||
await this.validateFeatureContext(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) {
|
if (strategyConfig.constraints?.length > 0) {
|
||||||
strategyConfig.constraints = await this.validateConstraints(
|
strategyConfig.constraints = await this.validateConstraints(
|
||||||
strategyConfig.constraints,
|
strategyConfig.constraints,
|
||||||
@ -387,12 +382,6 @@ class FeatureToggleService {
|
|||||||
const existingStrategy = await this.featureStrategiesStore.get(id);
|
const existingStrategy = await this.featureStrategiesStore.get(id);
|
||||||
this.validateFeatureStrategyContext(existingStrategy, context);
|
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 (existingStrategy.id === id) {
|
||||||
if (updates.constraints?.length > 0) {
|
if (updates.constraints?.length > 0) {
|
||||||
updates.constraints = await this.validateConstraints(
|
updates.constraints = await this.validateConstraints(
|
||||||
@ -441,12 +430,6 @@ class FeatureToggleService {
|
|||||||
): Promise<Saved<IStrategyConfig>> {
|
): Promise<Saved<IStrategyConfig>> {
|
||||||
const { projectId, environment, featureName } = context;
|
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);
|
const existingStrategy = await this.featureStrategiesStore.get(id);
|
||||||
this.validateFeatureStrategyContext(existingStrategy, context);
|
this.validateFeatureStrategyContext(existingStrategy, context);
|
||||||
|
|
||||||
@ -499,12 +482,6 @@ class FeatureToggleService {
|
|||||||
const { featureName, projectId, environment } = context;
|
const { featureName, projectId, environment } = context;
|
||||||
this.validateFeatureStrategyContext(existingStrategy, 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);
|
await this.featureStrategiesStore.delete(id);
|
||||||
|
|
||||||
const tags = await this.tagStore.getAllTagsForFeature(featureName);
|
const tags = await this.tagStore.getAllTagsForFeature(featureName);
|
||||||
@ -926,12 +903,6 @@ class FeatureToggleService {
|
|||||||
createdBy: string,
|
createdBy: string,
|
||||||
user?: User,
|
user?: User,
|
||||||
): Promise<FeatureToggle> {
|
): Promise<FeatureToggle> {
|
||||||
if (await this.changeRequestsEnabled(project, environment)) {
|
|
||||||
throw new Error(
|
|
||||||
`Features can only be updated through change requests for ${environment} environment`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasEnvironment =
|
const hasEnvironment =
|
||||||
await this.featureEnvironmentStore.featureHasEnvironment(
|
await this.featureEnvironmentStore.featureHasEnvironment(
|
||||||
environment,
|
environment,
|
||||||
@ -1220,13 +1191,6 @@ class FeatureToggleService {
|
|||||||
});
|
});
|
||||||
return variableVariants.concat(fixedVariants);
|
return variableVariants.concat(fixedVariants);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeRequestsEnabled(
|
|
||||||
project: string,
|
|
||||||
environment: string,
|
|
||||||
): Promise<boolean> {
|
|
||||||
return this.accessService.isChangeRequestsEnabled(project, environment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default FeatureToggleService;
|
export default FeatureToggleService;
|
||||||
|
Loading…
Reference in New Issue
Block a user