Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: select all apply to filtered policies only, skip replacing existing policies

Scott Wilsonb6a957a30d40
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
index ec272676e6..e636bdfe46 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
@@ -86,7 +86,7 @@ const Content = ({ onClose }: ContentProps) => {
[...rootPolicyValue, {}],
{ shouldDirty: true, shouldTouch: true }
);
- } else {
+ } else if (!rootPolicyValue?.length) {
rootForm.setValue(
`permissions.${type}`,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -130,7 +130,7 @@ const Content = ({ onClose }: ContentProps) => {
setValue(
"permissions",
Object.fromEntries(
- Object.values(ProjectPermissionSub).map((subject) => [subject, true])
+ filteredPolicies.map((subject) => [subject, true])
) as TForm["permissions"],
{ shouldDirty: true }
);