Skip to content

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

fix: prefer-destructuring in permission.ts and sort imports in secret sync components

IgorHorta1b2ef6fde816
diff --git a/frontend/src/lib/fn/permission.ts b/frontend/src/lib/fn/permission.ts
index d0ea96fcaf..ddee32c2fb 100644
--- a/frontend/src/lib/fn/permission.ts
+++ b/frontend/src/lib/fn/permission.ts
@@ -16,9 +16,9 @@ export function getSecretSyncPermissionSubject(sync: {
environment?: { slug: string } | null;
folder?: { path: string } | null;
}) {
- const connectionId = sync.connectionId;
- const envSlug = sync.environment?.slug ?? undefined;
- const secretPathVal = sync.folder?.path ?? undefined;
+ const { connectionId, environment, folder } = sync;
+ const envSlug = environment?.slug ?? undefined;
+ const secretPathVal = folder?.path ?? undefined;
const hasAny = connectionId || envSlug || secretPathVal;
if (!hasAny) return ProjectPermissionSub.SecretSyncs;
return subject(ProjectPermissionSub.SecretSyncs, {
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncRow.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncRow.tsx
index 91b5ad0406..9c6b8310ee 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncRow.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncRow.tsx
@@ -22,7 +22,6 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import {
SecretSyncImportStatusBadge,
SecretSyncRemoveStatusBadge,
@@ -45,6 +44,7 @@ import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissi
import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import { useToggle } from "@app/hooks";
import { SecretSyncStatus, TSecretSync, useSecretSyncOption } from "@app/hooks/api/secretSyncs";
+import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { SecretSyncDestinationCol } from "./SecretSyncDestinationCol";
import { SecretSyncTableCell } from "./SecretSyncTableCell";
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncActionTriggers.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncActionTriggers.tsx
index 2ce58447e7..2ec3ff6195 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncActionTriggers.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncActionTriggers.tsx
@@ -37,7 +37,6 @@ import { Badge } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { useOrganization } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
-import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import { usePopUp, useToggle } from "@app/hooks";
import {
@@ -46,6 +45,7 @@ import {
useTriggerSecretSyncSyncSecrets,
useUpdateSecretSync
} from "@app/hooks/api/secretSyncs";
+import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { IntegrationsListPageTabs } from "@app/types/integrations";
type Props = {
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
index 809ca9346f..6ae007c8a8 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
@@ -6,9 +6,9 @@ import { ProjectPermissionCan } from "@app/components/permissions";
import { GenericFieldLabel } from "@app/components/secret-syncs";
import { IconButton } from "@app/components/v2";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
-import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
import { SecretSync, TSecretSync } from "@app/hooks/api/secretSyncs";
+import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { OnePassSyncDestinationSection } from "./1PasswordSyncDestinationSection";
import { AwsParameterStoreSyncDestinationSection } from "./AwsParameterStoreSyncDestinationSection";
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx
index 1a20f90cf7..20aa1abc85 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDetailsSection.tsx
@@ -7,8 +7,8 @@ import { ProjectPermissionCan } from "@app/components/permissions";
import { GenericFieldLabel, SecretSyncStatusBadge } from "@app/components/secret-syncs";
import { IconButton } from "@app/components/v2";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
-import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { SecretSyncStatus, TSecretSync } from "@app/hooks/api/secretSyncs";
+import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
type Props = {
secretSync: TSecretSync;
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
index 2bafe0b6fa..e159c6b9ef 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
@@ -7,9 +7,9 @@ import { GenericFieldLabel } from "@app/components/secret-syncs";
import { IconButton } from "@app/components/v2";
import { Badge } from "@app/components/v3";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
-import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP } from "@app/helpers/secretSyncs";
import { SecretSync, TSecretSync } from "@app/hooks/api/secretSyncs";
+import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { AwsParameterStoreSyncOptionsSection } from "./AwsParameterStoreSyncOptionsSection";
import { AwsSecretsManagerSyncOptionsSection } from "./AwsSecretsManagerSyncOptionsSection";
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncSourceSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncSourceSection.tsx
index 827deab018..b0c16b6a26 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncSourceSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncSourceSection.tsx
@@ -7,8 +7,8 @@ import { GenericFieldLabel } from "@app/components/secret-syncs";
import { IconButton, Tooltip } from "@app/components/v2";
import { Badge } from "@app/components/v3";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
-import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { TSecretSync } from "@app/hooks/api/secretSyncs";
+import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
type Props = {
secretSync: TSecretSync;