import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal"; import { createNotification } from "@app/components/notifications"; import { OrgPermissionCan } from "@app/components/permissions"; import { Button, Switch } from "@app/components/v2"; import { OrgPermissionActions, OrgPermissionSubjects, useOrganization, useSubscription } from "@app/context"; import { useUpdateOrg } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { ExternalGroupOrgRoleMappings } from "./ExternalGroupOrgRoleMappings"; import { ScimTokenModal } from "./ScimTokenModal"; export const OrgScimSection = () => { const { currentOrg } = useOrganization(); const { subscription } = useSubscription(); const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([ "scimToken", "deleteScimToken", "upgradePlan" ] as const); const { mutateAsync } = useUpdateOrg(); const addScimTokenBtnClick = () => { if (subscription?.scim) { handlePopUpOpen("scimToken"); } else { handlePopUpOpen("upgradePlan", { isEnterpriseFeature: true }); } }; const handleEnableSCIMToggle = async (value: boolean) => { try { if (!currentOrg?.id) return; if (!subscription?.scim) { handlePopUpOpen("upgradePlan", { isEnterpriseFeature: true }); return; } await mutateAsync({ orgId: currentOrg?.id, scimEnabled: value }); createNotification({ text: `Successfully ${value ? "enabled" : "disabled"} SCIM provisioning`, type: "success" }); } catch (err) { createNotification({ text: (err as { response: { data: { message: string } } }).response.data.message, type: "error" }); } }; return (

Provision users via SCIM

SCIM

{(isAllowed) => ( )}

Manage SCIM configuration

Enable SCIM

{(isAllowed) => ( { if (subscription?.scim) { handleEnableSCIMToggle(value); } else { handlePopUpOpen("upgradePlan", { isEnterpriseFeature: true }); } }} isChecked={currentOrg?.scimEnabled ?? false} isDisabled={!isAllowed} /> )}

Allow member provisioning/deprovisioning with SCIM

handlePopUpToggle("upgradePlan", isOpen)} text="You can use SCIM Provisioning if you switch to Infisical's Enterprise plan." isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature} />
); };