mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-31 01:16:01 +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;
|
||||
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<Saved<IStrategyConfig>> {
|
||||
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<FeatureToggle> {
|
||||
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<boolean> {
|
||||
return this.accessService.isChangeRequestsEnabled(project, environment);
|
||||
}
|
||||
}
|
||||
|
||||
export default FeatureToggleService;
|
||||
|
Loading…
Reference in New Issue
Block a user