Skip to content

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

899 B
Raw Blame
import { subject } from "@casl/ability";

import { ProjectPermissionCan } from "@app/components/permissions";
import { ProjectPermissionIdentityActions, ProjectPermissionSub } from "@app/context";
import { AlertResourceType } from "@app/hooks/api/alerts";
import { AlertAction } from "@app/views/Alerts";

type Props = {
  identityId: string;
  projectId?: string;
  readOnly?: boolean;
};

export const ProjectIdentityAlertAction = ({ identityId, projectId, readOnly = false }: Props) => (
  <AlertAction
    resourceType={AlertResourceType.IdentityAuthentication}
    resourceId={identityId}
    projectId={projectId}
    readOnly={readOnly}
    renderPermissionGate={(render) => (
      <ProjectPermissionCan
        I={ProjectPermissionIdentityActions.Edit}
        a={subject(ProjectPermissionSub.Identity, { identityId })}
      >
        {render}
      </ProjectPermissionCan>
    )}
  />
);