diff --git a/backend/src/controllers/v2/secretsController.ts b/backend/src/controllers/v2/secretsController.ts index 84b3af681..1088152df 100644 --- a/backend/src/controllers/v2/secretsController.ts +++ b/backend/src/controllers/v2/secretsController.ts @@ -163,19 +163,19 @@ export const batchSecrets = async (req: Request, res: Response) => { // not using service token using auth if (!(req.authData.authPayload instanceof ServiceTokenData)) { const { permission } = await getUserProjectPermissions(req.user._id, workspaceId); - if (!createSecrets.length) + if (createSecrets.length) ForbiddenError.from(permission).throwUnlessCan( ProjectPermissionActions.Create, subject(ProjectPermissionSub.Secrets, { environment, secretPath }) ); - if (!updateSecrets.length) + if (updateSecrets.length) ForbiddenError.from(permission).throwUnlessCan( ProjectPermissionActions.Edit, subject(ProjectPermissionSub.Secrets, { environment, secretPath }) ); - if (!deleteSecrets.length) + if (deleteSecrets.length) ForbiddenError.from(permission).throwUnlessCan( ProjectPermissionActions.Delete, subject(ProjectPermissionSub.Secrets, { environment, secretPath }) diff --git a/frontend/src/views/DashboardPage/DashboardPage.tsx b/frontend/src/views/DashboardPage/DashboardPage.tsx index 46cb89835..5935d088f 100644 --- a/frontend/src/views/DashboardPage/DashboardPage.tsx +++ b/frontend/src/views/DashboardPage/DashboardPage.tsx @@ -333,6 +333,10 @@ export const DashboardPage = () => { permission.cannot( ProjectPermissionActions.Edit, subject(ProjectPermissionSub.Secrets, { environment, secretPath }) + ) && + permission.cannot( + ProjectPermissionActions.Create, + subject(ProjectPermissionSub.Secrets, { environment, secretPath }) ); const canDoRollback = !isReadOnly; diff --git a/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx b/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx index 745e98878..c31c6df2e 100644 --- a/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx +++ b/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx @@ -304,10 +304,6 @@ export const SecretInputRow = memo( (isOverridden ? isAddOnly : shouldBeBlockedInAddOnly) } {...field} - onChange={(val) => { - console.log(val); - field.onChange(val); - }} /> )} />