feat: integrate telemetry service for secret synchronization events and update project role permissions to reflect workspace integrations

This commit is contained in:
Victor Santos
2025-11-26 16:52:12 -03:00
parent f98b803e76
commit 9ffb440639
7 changed files with 84 additions and 81 deletions
@@ -18,7 +18,8 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionSub, useProject } from "@app/context";
import { useGetWorkspaceIntegrations } from "@app/hooks/api";
import { ProjectType } from "@app/hooks/api/projects/types";
import {
@@ -46,6 +47,9 @@ type TForm = { permissions: Record<ProjectPermissionSub, boolean> };
const Content = ({ onClose, type: projectType }: ContentProps) => {
const rootForm = useFormContext<TFormSchema>();
const [search, setSearch] = useState("");
const { currentProject } = useProject();
const { data: integrations = [] } = useGetWorkspaceIntegrations(currentProject?.id ?? "");
const {
control,
handleSubmit,
@@ -60,6 +64,8 @@ const Content = ({ onClose, type: projectType }: ContentProps) => {
}
});
const hasNativeIntegrations = integrations.length > 0;
const filteredPolicies = Object.entries(PROJECT_PERMISSION_OBJECT)
.filter(
([subject, { title }]) =>
@@ -68,6 +74,11 @@ const Content = ({ onClose, type: projectType }: ContentProps) => {
] && (search ? title.toLowerCase().includes(search.toLowerCase()) : true)
)
.filter(([subject]) => !EXCLUDED_PERMISSION_SUBS.includes(subject as ProjectPermissionSub))
.filter(
([subject]) =>
// Hide Native Integrations policy if project has no integrations
subject !== ProjectPermissionSub.Integrations || hasNativeIntegrations
)
.sort((a, b) => a[1].title.localeCompare(b[1].title))
.map(([subject]) => subject);
@@ -11,7 +11,11 @@ import { Button } from "@app/components/v2";
import { ProjectPermissionSub, useProject } from "@app/context";
import { ProjectPermissionSet } from "@app/context/ProjectPermissionContext";
import { evaluatePermissionsAbility } from "@app/helpers/permissions";
import { useGetProjectRoleBySlug, useUpdateProjectRole } from "@app/hooks/api";
import {
useGetProjectRoleBySlug,
useGetWorkspaceIntegrations,
useUpdateProjectRole
} from "@app/hooks/api";
import { ProjectType } from "@app/hooks/api/projects/types";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
@@ -105,6 +109,8 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
currentProject?.id ?? "",
roleSlug as string
);
const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId);
const hasNativeIntegrations = integrations.length > 0;
const [showAccessTree, setShowAccessTree] = useState<ProjectPermissionSub | null>(null);
@@ -198,6 +204,11 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
{!isPending && <PermissionEmptyState />}
{(Object.keys(PROJECT_PERMISSION_OBJECT) as ProjectPermissionSub[])
.filter((subject) => !EXCLUDED_PERMISSION_SUBS.includes(subject))
.filter(
(subject) =>
// Hide Native Integrations policy if project has no integrations
subject !== ProjectPermissionSub.Integrations || hasNativeIntegrations
)
.map((subject) => (
<GeneralPermissionPolicies
subject={subject}
@@ -1,17 +1,11 @@
import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
import { faWarning } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Alert,
AlertDescription,
PageHeader,
Tab,
TabList,
TabPanel,
Tabs
} from "@app/components/v2";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import {
ProjectPermissionActions,
@@ -106,28 +100,33 @@ export const IntegrationsListPage = () => {
</TabPanel>
{hasNativeIntegrations && (
<TabPanel value={IntegrationsListPageTabs.NativeIntegrations}>
<Alert variant="warning" className="mb-4" hideTitle>
<AlertDescription>
We&apos;re moving Native Integrations to{" "}
<a
href="https://infisical.com/docs/integrations/secret-syncs/overview"
target="_blank"
rel="noopener noreferrer"
className="underline underline-offset-2 hover:text-mineshaft-100"
>
Secret Syncs
</a>
. If the integration you need isn&apos;t available in the Secret Syncs menu,
please get in touch with us at{" "}
<a
href="mailto:[email protected]"
className="underline underline-offset-2 hover:text-mineshaft-100"
>
team@infisical.com
</a>
.
</AlertDescription>
</Alert>
<div className="mb-4 flex items-start rounded-md border border-yellow-600 bg-yellow-900/20 px-3 py-2">
<div className="flex text-sm text-yellow-100">
<FontAwesomeIcon icon={faWarning} className="mt-1 mr-2 text-yellow-600" />
<div>
<p>
We&apos;re moving Native Integrations to{" "}
<a
href="https://infisical.com/docs/integrations/secret-syncs/overview"
target="_blank"
rel="noopener noreferrer"
className="underline underline-offset-2 hover:text-mineshaft-100"
>
Secret Syncs
</a>
. If the integration you need isn&apos;t available in the Secret Syncs menu,
please get in touch with us at{" "}
<a
href="mailto:team@infisical.com"
className="underline underline-offset-2 hover:text-mineshaft-100"
>
team@infisical.com
</a>
.
</p>
</div>
</div>
</div>
<ProjectPermissionCan
renderGuardBanner
I={ProjectPermissionActions.Read}