From c1092bacf9866cb71181137f9c6ccb687cdf5e24 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 6 Sep 2024 11:49:11 +0200 Subject: [PATCH] fix: give project_default_strategy_write the ability to update the default strategy (#8112) This appears to have been an oversight in the original implementation of this endpoint. This seems to be the primary point of this permission. Additionally, the docs mention that this permission should allow you to do just that. Note: I've not added any tests for this, because we don't typically add tests for it. If we have an example to follow, I'd be very happy to add it, though --- src/lib/features/project-environments/environments.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/features/project-environments/environments.ts b/src/lib/features/project-environments/environments.ts index a80010edce..0ccc75656d 100644 --- a/src/lib/features/project-environments/environments.ts +++ b/src/lib/features/project-environments/environments.ts @@ -5,6 +5,7 @@ import { type IUnleashServices, serializeDates, UPDATE_PROJECT, + PROJECT_DEFAULT_STRATEGY_WRITE, } from '../../types'; import type { Logger } from '../../logger'; import type EnvironmentService from './environment-service'; @@ -105,7 +106,7 @@ export default class EnvironmentsController extends Controller { method: 'post', path: `${PREFIX}/:environment/default-strategy`, handler: this.updateDefaultStrategyForProjectEnvironment, - permission: UPDATE_PROJECT, + permission: [UPDATE_PROJECT, PROJECT_DEFAULT_STRATEGY_WRITE], middleware: [ openApiService.validPath({ tags: ['Projects'],