Skip to content

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

PKI UI improvements

Carlos Monastyrski0359ebd9f9c0
diff --git a/backend/src/ee/services/permission/default-roles.ts b/backend/src/ee/services/permission/default-roles.ts
index 4ab4675c3a..229143f5cc 100644
--- a/backend/src/ee/services/permission/default-roles.ts
+++ b/backend/src/ee/services/permission/default-roles.ts
@@ -917,7 +917,8 @@ const buildApplicationAdminPermissionRules = () => {
[
ResourcePermissionApplicationActions.Read,
ResourcePermissionApplicationActions.Edit,
- ResourcePermissionApplicationActions.Delete
+ ResourcePermissionApplicationActions.Delete,
+ ResourcePermissionApplicationActions.ManageProfiles
],
ResourcePermissionSub.Application
);
@@ -1092,11 +1093,7 @@ const buildApplicationProjectAdminFallbackRules = () => {
const { can, rules } = new AbilityBuilder<MongoAbility<ResourcePermissionSet>>(createMongoAbility);
can(
- [
- ResourcePermissionApplicationActions.Read,
- ResourcePermissionApplicationActions.Edit,
- ResourcePermissionApplicationActions.Delete
- ],
+ [ResourcePermissionApplicationActions.Read, ResourcePermissionApplicationActions.ManageProfiles],
ResourcePermissionSub.Application
);
diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.ts
index 7990dfc9af..0560594013 100644
--- a/backend/src/ee/services/permission/permission-service.ts
+++ b/backend/src/ee/services/permission/permission-service.ts
@@ -642,13 +642,26 @@ export const permissionServiceFactory = ({
actorType: actor
});
+ const projectPerm = await getProjectPermission({
+ actor,
+ actorId,
+ projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+ const isProjectAdmin = projectPerm.hasRole(ProjectMembershipRole.Admin);
+
if (resourceMemberships?.length) {
const permissionFromRoles = flattenActiveRolesFromMemberships(
resourceMemberships,
ApplicationMembershipRole.Custom
);
- const rules = buildResourcePermissionRules(permissionFromRoles);
- const permission = createMongoAbility<ResourcePermissionSet>(rules, { conditionsMatcher });
+ const resourceRules = buildResourcePermissionRules(permissionFromRoles);
+ const mergedRules = isProjectAdmin
+ ? [...resourceRules, ...applicationProjectAdminFallbackPermissions]
+ : resourceRules;
+ const permission = createMongoAbility<ResourcePermissionSet>(mergedRules, { conditionsMatcher });
const hasRole = (role: string) =>
resourceMemberships.some((m) => m.roles.some((r) => role === (r.customRoleSlug || r.role)));
@@ -661,16 +674,7 @@ export const permissionServiceFactory = ({
};
}
- const projectPerm = await getProjectPermission({
- actor,
- actorId,
- projectId,
- actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.CertificateManager
- });
-
- if (projectPerm.hasRole(ProjectMembershipRole.Admin)) {
+ if (isProjectAdmin) {
const permission = createMongoAbility<ResourcePermissionSet>(applicationProjectAdminFallbackPermissions, {
conditionsMatcher
});
diff --git a/backend/src/ee/services/permission/resource-permission.ts b/backend/src/ee/services/permission/resource-permission.ts
index cfb62bfba2..5df8717ba7 100644
--- a/backend/src/ee/services/permission/resource-permission.ts
+++ b/backend/src/ee/services/permission/resource-permission.ts
@@ -26,7 +26,8 @@ export enum ResourcePermissionSub {
export enum ResourcePermissionApplicationActions {
Read = "read",
Edit = "edit",
- Delete = "delete"
+ Delete = "delete",
+ ManageProfiles = "manage-profiles"
}
export enum ResourcePermissionApplicationEnrollmentActions {
diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.ts
index 5a1b22cff3..00b1b697b6 100644
--- a/backend/src/services/certificate-profile/certificate-profile-service.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-service.ts
@@ -273,7 +273,7 @@ type TCertificateProfileServiceFactoryDep = {
resourceMetadataDAL: Pick<TResourceMetadataDALFactory, "find">;
pkiApplicationProfileDAL?: Pick<
TPkiApplicationProfileDALFactory,
- "findOneByApplicationAndProfile" | "findByApplicationId"
+ "findOneByApplicationAndProfile" | "findByApplicationId" | "findAllByProfileId"
>;
};
@@ -1165,6 +1165,21 @@ export const certificateProfileServiceFactory = ({
})
);
+ if (pkiApplicationProfileDAL) {
+ const attachments = await pkiApplicationProfileDAL.findAllByProfileId(profileId);
+ if (attachments.length > 0) {
+ const uniqueNames = Array.from(new Set(attachments.map((a) => a.applicationName))).sort();
+ const preview = uniqueNames.slice(0, 5).join(", ");
+ const remaining = uniqueNames.length - 5;
+ const list = remaining > 0 ? `${preview}, and ${remaining} more` : preview;
+ throw new BadRequestError({
+ message: `Cannot delete this certificate profile while it is attached to ${uniqueNames.length} application${
+ uniqueNames.length === 1 ? "" : "s"
+ } (${list}). Detach the profile from those applications first.`
+ });
+ }
+ }
+
const deletedProfile = await certificateProfileDAL.deleteById(profileId);
if (!deletedProfile) {
throw new NotFoundError({ message: "Failed to delete certificate profile" });
diff --git a/backend/src/services/pki-application/pki-application-membership-service.ts b/backend/src/services/pki-application/pki-application-membership-service.ts
index 8a7f745d95..7b33821ce3 100644
--- a/backend/src/services/pki-application/pki-application-membership-service.ts
+++ b/backend/src/services/pki-application/pki-application-membership-service.ts
@@ -240,10 +240,7 @@ export const pkiApplicationMembershipServiceFactory = ({
},
tx
);
- await membershipRoleDAL.create(
- { membershipId: projectMembership.id, role: ProjectMembershipRole.NoAccess },
- tx
- );
+ await membershipRoleDAL.create({ membershipId: projectMembership.id, role: ProjectMembershipRole.Member }, tx);
}
const newMembership = await membershipDAL.create(
diff --git a/backend/src/services/pki-application/pki-application-profile-dal.ts b/backend/src/services/pki-application/pki-application-profile-dal.ts
index 5525c53d66..47ef646d09 100644
--- a/backend/src/services/pki-application/pki-application-profile-dal.ts
+++ b/backend/src/services/pki-application/pki-application-profile-dal.ts
@@ -65,7 +65,22 @@ export const pkiApplicationProfileDALFactory = (db: TDbClient) => {
const findAllByProfileId = async (profileId: string, tx?: Knex) => {
try {
- const rows = await (tx || db.replicaNode())(TableName.PkiApplicationProfile).where({ profileId });
+ const rows = await (tx || db.replicaNode())(TableName.PkiApplicationProfile)
+ .innerJoin(
+ TableName.PkiApplication,
+ `${TableName.PkiApplicationProfile}.applicationId`,
+ `${TableName.PkiApplication}.id`
+ )
+ .where(`${TableName.PkiApplicationProfile}.profileId`, profileId)
+ .select(
+ `${TableName.PkiApplicationProfile}.applicationId`,
+ `${TableName.PkiApplicationProfile}.profileId`,
+ `${TableName.PkiApplicationProfile}.apiConfigId`,
+ `${TableName.PkiApplicationProfile}.estConfigId`,
+ `${TableName.PkiApplicationProfile}.acmeConfigId`,
+ `${TableName.PkiApplicationProfile}.scepConfigId`,
+ `${TableName.PkiApplication}.name as applicationName`
+ );
return rows as Array<{
applicationId: string;
profileId: string;
@@ -73,6 +88,7 @@ export const pkiApplicationProfileDALFactory = (db: TDbClient) => {
estConfigId?: string | null;
acmeConfigId?: string | null;
scepConfigId?: string | null;
+ applicationName: string;
}>;
} catch (error) {
throw new DatabaseError({ error, name: "Find all application junctions for profile" });
diff --git a/backend/src/services/pki-application/pki-application-service.ts b/backend/src/services/pki-application/pki-application-service.ts
index 3813fdcf66..4ee2ac58a5 100644
--- a/backend/src/services/pki-application/pki-application-service.ts
+++ b/backend/src/services/pki-application/pki-application-service.ts
@@ -11,7 +11,6 @@ import {
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
import {
ProjectPermissionApplicationActions,
- ProjectPermissionCertificateProfileActions,
ProjectPermissionSub
} from "@app/ee/services/permission/project-permission";
import {
@@ -432,18 +431,16 @@ export const pkiApplicationServiceFactory = ({
throw new NotFoundError({ message: `Application with id '${applicationId}' not found.` });
}
- const { permission } = await permissionService.getProjectPermission({
+ const { permission } = await $loadResourcePermission(applicationId, projectId, {
actor,
actorId,
- projectId,
actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.CertificateManager
+ actorOrgId
});
ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionCertificateProfileActions.ManageApplicationAttachments,
- ProjectPermissionSub.CertificateProfiles
+ ResourcePermissionApplicationActions.ManageProfiles,
+ ResourcePermissionSub.Application
);
const profilesInProject = await pkiApplicationProfileDAL.findProfilesInProject(profileIds, projectId);
@@ -481,18 +478,16 @@ export const pkiApplicationServiceFactory = ({
throw new NotFoundError({ message: `Application with id '${applicationId}' not found.` });
}
- const { permission } = await permissionService.getProjectPermission({
+ const { permission } = await $loadResourcePermission(applicationId, projectId, {
actor,
actorId,
- projectId,
actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.CertificateManager
+ actorOrgId
});
ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionCertificateProfileActions.ManageApplicationAttachments,
- ProjectPermissionSub.CertificateProfiles
+ ResourcePermissionApplicationActions.ManageProfiles,
+ ResourcePermissionSub.Application
);
const link = await pkiApplicationProfileDAL.findOneByApplicationAndProfile(applicationId, profileId);
diff --git a/frontend/src/hooks/api/pkiApplications/types.ts b/frontend/src/hooks/api/pkiApplications/types.ts
index a36800b1db..0d79a083b6 100644
--- a/frontend/src/hooks/api/pkiApplications/types.ts
+++ b/frontend/src/hooks/api/pkiApplications/types.ts
@@ -29,7 +29,8 @@ export enum PkiApplicationResourceActions {
RemoveCertificates = "remove-certificates",
RevealAcmeEabSecret = "reveal-acme-eab-secret",
RotateAcmeEabSecret = "rotate-acme-eab-secret",
- GenerateScepChallenge = "generate-scep-challenge"
+ GenerateScepChallenge = "generate-scep-challenge",
+ ManageProfiles = "manage-profiles"
}
export type TPkiApplicationPermissionSet = [string, string];
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgNav.tsx
index ab1bb932fd..54a7011e8d 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgNav.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgNav.tsx
@@ -22,7 +22,6 @@ import {
SubOrgIcon
} from "@app/components/v3";
import { useOrganization, useSubscription } from "@app/context";
-import { useCertManagerInstanceState } from "@app/hooks/api/certManagerInstance";
import {
getOrgSettingsSubmenu,
@@ -38,10 +37,8 @@ import type { OrgNavItem, Submenu } from "./types";
const OrgNav = ({ onSubmenuOpen }: { onSubmenuOpen: (submenu: Submenu) => void }) => {
const { currentOrg, isRootOrganization, isSubOrganization } = useOrganization();
const { subscription } = useSubscription();
- const { data: certManagerInstance } = useCertManagerInstanceState();
const { pathname } = useLocation();
const orgId = currentOrg.id;
- const hasMultipleCertManagerInstances = (certManagerInstance?.projects.length ?? 0) >= 2;
const items: OrgNavItem[] = [
{
@@ -102,8 +99,7 @@ const OrgNav = ({ onSubmenuOpen }: { onSubmenuOpen: (submenu: Submenu) => void }
isActive: pathname.startsWith(`/organizations/${orgId}/settings`),
submenu: getOrgSettingsSubmenu({
isSubOrganization,
- hasSubOrganization: Boolean(subscription?.subOrganization),
- hasMultipleCertManagerInstances
+ hasSubOrganization: Boolean(subscription?.subOrganization)
})
}
];
@@ -151,11 +147,9 @@ const OrgNav = ({ onSubmenuOpen }: { onSubmenuOpen: (submenu: Submenu) => void }
export const OrgNavWrapper = () => {
const { currentOrg, isSubOrganization } = useOrganization();
const { subscription } = useSubscription();
- const { data: certManagerInstance } = useCertManagerInstanceState();
const { pathname } = useLocation();
const navigate = useNavigate();
const orgId = currentOrg.id;
- const hasMultipleCertManagerInstances = (certManagerInstance?.projects.length ?? 0) >= 2;
const isOnAccessControl =
pathname.startsWith(`/organizations/${orgId}/access-management`) ||
@@ -169,8 +163,7 @@ export const OrgNavWrapper = () => {
if (isOnSettings)
return getOrgSettingsSubmenu({
isSubOrganization,
- hasSubOrganization: Boolean(subscription?.subOrganization),
- hasMultipleCertManagerInstances
+ hasSubOrganization: Boolean(subscription?.subOrganization)
});
if (isOnSecretSharing) return getSecretSharingSubmenu({ isSubOrganization });
if (isOnNetworking) return NETWORKING_SUBMENU;
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx
index 5029aa49be..9f34262338 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNav.tsx
@@ -19,6 +19,7 @@ import {
CERT_CERTIFICATES_SUBMENU,
CERT_DISCOVERY_SUBMENU,
CERT_INTEGRATIONS_SUBMENU,
+ CERT_MANAGER_ACCESS_CONTROL_SUBMENU,
INTEGRATIONS_SUBMENU,
MCP_SUBMENU,
PAM_APPROVALS_SUBMENU,
@@ -80,10 +81,12 @@ export const ProjectNav = () => {
const getInitialProjectSubmenu = (): Submenu | null => {
if (isLegacyView || hasApplicationContext || isFromRootRequests) return null;
- if (isOnAccessControl)
- return currentProject.type === ProjectType.SecretManager
- ? SECRET_MANAGER_ACCESS_CONTROL_SUBMENU
- : PROJECT_ACCESS_CONTROL_SUBMENU;
+ if (isOnAccessControl) {
+ if (currentProject.type === ProjectType.SecretManager)
+ return SECRET_MANAGER_ACCESS_CONTROL_SUBMENU;
+ if (isCertManager) return CERT_MANAGER_ACCESS_CONTROL_SUBMENU;
+ return PROJECT_ACCESS_CONTROL_SUBMENU;
+ }
if (isOnIntegrations && currentProject.type === ProjectType.SecretManager)
return INTEGRATIONS_SUBMENU;
if (isOnIntegrations && isCertManager) return CERT_INTEGRATIONS_SUBMENU;
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
index 339e0adfbc..bb04d37d8b 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
@@ -86,7 +86,7 @@ export const CERT_MANAGER_ACCESS_CONTROL_SUBMENU: Submenu = {
title: "Access Control",
pathSuffix: "access-management",
defaultTab: "members",
- activeMatch: /\/members\/|\/groups\/|\/identities\/|\/roles\//,
+ activeMatch: /\/members\/|\/groups\/|\/identities\//,
items: [
{ label: "Users", icon: User, tab: "members", activeMatch: /\/members\// },
{ label: "Groups", icon: Users, tab: "groups", activeMatch: /\/groups\// },
@@ -95,8 +95,7 @@ export const CERT_MANAGER_ACCESS_CONTROL_SUBMENU: Submenu = {
icon: HardDrive,
tab: "identities",
activeMatch: /\/identities\//
- },
- { label: "Roles", icon: IdCardLanyard, tab: "roles", activeMatch: /\/roles\// }
+ }
]
};
@@ -129,12 +128,10 @@ export const INTEGRATIONS_SUBMENU: Submenu = {
export const getOrgSettingsSubmenu = ({
isSubOrganization,
- hasSubOrganization,
- hasMultipleCertManagerInstances
+ hasSubOrganization
}: {
isSubOrganization: boolean;
hasSubOrganization: boolean;
- hasMultipleCertManagerInstances: boolean;
}): Submenu => ({
title: "Settings",
pathSuffix: "settings",
@@ -154,9 +151,6 @@ export const getOrgSettingsSubmenu = ({
{ label: "External Migrations", icon: Database, tab: "tab-external-migrations" },
{ label: "Project Templates", icon: FolderCog, tab: "project-templates" },
{ label: "Product Settings", icon: ClipboardList, tab: "product-settings" },
- ...(hasMultipleCertManagerInstances
- ? [{ label: "Certificate Manager", icon: ShieldCheck, tab: "cert-manager" }]
- : []),
...(!isSubOrganization && hasSubOrganization
? [{ label: "Sub Organizations", icon: SubOrgIcon, tab: "tab-sub-organizations" }]
: [])
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
index 203049dd59..526052c374 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
@@ -74,6 +74,12 @@ export const ApplicationDetailsByIDPage = () => {
PkiApplicationResourceSub.PkiSyncs
);
const canViewRequests = canViewCertificates;
+ const canEditApplication = Boolean(
+ ability?.can(PkiApplicationResourceActions.Edit, PkiApplicationResourceSub.Application)
+ );
+ const canDeleteApplication = Boolean(
+ ability?.can(PkiApplicationResourceActions.Delete, PkiApplicationResourceSub.Application)
+ );
const requestedTab = search.selectedTab ?? "";
const tabIsVisible: Record<string, boolean> = {
@@ -159,11 +165,18 @@ export const ApplicationDetailsByIDPage = () => {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" sideOffset={2}>
- <DropdownMenuItem onClick={() => handleEditPopUpOpen("application", application)}>
+ <DropdownMenuItem
+ isDisabled={!canEditApplication}
+ onClick={() => handleEditPopUpOpen("application", application)}
+ >
<FontAwesomeIcon icon={faPenToSquare} />
Edit Application
</DropdownMenuItem>
- <DropdownMenuItem variant="danger" onClick={() => setIsDeleteOpen(true)}>
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!canDeleteApplication}
+ onClick={() => setIsDeleteOpen(true)}
+ >
<FontAwesomeIcon icon={faTrash} />
Delete Application
</DropdownMenuItem>
@@ -190,7 +203,7 @@ export const ApplicationDetailsByIDPage = () => {
<TabList>
{canViewCertificates && (
<Tab variant="project" value="certificates">
- Certificates
+ Inventory
</Tab>
)}
{canViewRequests && (
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationMembersTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationMembersTab.tsx
index 6e8bc7dd3a..dc41090292 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationMembersTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationMembersTab.tsx
@@ -34,7 +34,10 @@ import {
TableRow
} from "@app/components/v3";
import {
+ PkiApplicationResourceActions,
+ PkiApplicationResourceSub,
TPkiApplicationMember,
+ useGetPkiApplicationPermissions,
useRemovePkiApplicationMember,
useUpdatePkiApplicationMemberRole
} from "@app/hooks/api/pkiApplications";
@@ -81,6 +84,18 @@ export const ApplicationMembersTab = ({ members, applicationId }: Props) => {
] as const);
const [isAddOpen, setIsAddOpen] = useState(false);
+ const { data: permissionData } = useGetPkiApplicationPermissions(applicationId);
+ const ability = permissionData?.permission;
+ const canAddMember = Boolean(
+ ability?.can(PkiApplicationResourceActions.Create, PkiApplicationResourceSub.Member)
+ );
+ const canEditMember = Boolean(
+ ability?.can(PkiApplicationResourceActions.Edit, PkiApplicationResourceSub.Member)
+ );
+ const canDeleteMember = Boolean(
+ ability?.can(PkiApplicationResourceActions.Delete, PkiApplicationResourceSub.Member)
+ );
+
return (
<>
<Card>
@@ -90,7 +105,12 @@ export const ApplicationMembersTab = ({ members, applicationId }: Props) => {
Users, machine identities, and groups granted access to this Application.
</CardDescription>
<CardAction>
- <Button size="sm" variant="project" onClick={() => setIsAddOpen(true)}>
+ <Button
+ size="sm"
+ variant="project"
+ onClick={() => setIsAddOpen(true)}
+ isDisabled={!canAddMember}
+ >
<UserPlusIcon />
Add Member
</Button>
@@ -131,6 +151,7 @@ export const ApplicationMembersTab = ({ members, applicationId }: Props) => {
<TableCell>
<Select
value={m.role}
+ disabled={!canEditMember}
onValueChange={async (role) => {
try {
await updateRole.mutateAsync({
@@ -169,6 +190,7 @@ export const ApplicationMembersTab = ({ members, applicationId }: Props) => {
<DropdownMenuContent className="min-w-40" align="end" sideOffset={2}>
<DropdownMenuItem
variant="danger"
+ isDisabled={!canDeleteMember}
onClick={() => handlePopUpOpen("removeMember", m)}
>
<Trash2Icon />
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
index cce50fa951..9ca4aa54b8 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
@@ -1,7 +1,8 @@
-import { useMemo, useState } from "react";
+import { ReactNode, useMemo, useState } from "react";
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useQuery } from "@tanstack/react-query";
+import { Link, useParams } from "@tanstack/react-router";
import { formatDistance } from "date-fns";
import {
CircleStopIcon,
@@ -52,11 +53,6 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { useProjectPermission } from "@app/context";
-import {
- ProjectPermissionCertificateProfileActions,
- ProjectPermissionSub
-} from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import {
approvalPolicyQuery,
@@ -75,10 +71,13 @@ import {
useUpdatePkiAlertV2
} from "@app/hooks/api/pkiAlertsV2";
import {
+ PkiApplicationResourceActions,
+ PkiApplicationResourceSub,
TPkiApplication,
TPkiApplicationProfile,
useAttachPkiApplicationProfiles,
- useDetachPkiApplicationProfile
+ useDetachPkiApplicationProfile,
+ useGetPkiApplicationPermissions
} from "@app/hooks/api/pkiApplications";
import { PolicyModal } from "@app/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicyModal";
import { CreatePkiAlertV2Modal } from "@app/views/PkiAlertsV2Page/components/CreatePkiAlertV2Modal";
@@ -110,12 +109,16 @@ type ApplicationPoliciesTableProps = {
applicationId: string;
onEdit: (policy: TApprovalPolicy) => void;
onDelete: (policy: TApprovalPolicy) => void;
+ canEdit: boolean;
+ canDelete: boolean;
};
const ApplicationPoliciesTable = ({
applicationId,
onEdit,
- onDelete
+ onDelete,
+ canEdit,
+ canDelete
}: ApplicationPoliciesTableProps) => {
const { data: policies = [], isPending } = useQuery(
approvalPolicyQuery.list({
@@ -209,11 +212,15 @@ const ApplicationPoliciesTable = ({
</IconButton>
</DropdownMenuTrigger>
<DropdownMenuContent className="min-w-40" align="end" sideOffset={2}>
- <DropdownMenuItem onClick={() => onEdit(policy)}>
+ <DropdownMenuItem isDisabled={!canEdit} onClick={() => onEdit(policy)}>
<PencilIcon />
Edit Policy
</DropdownMenuItem>
- <DropdownMenuItem variant="danger" onClick={() => onDelete(policy)}>
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!canDelete}
+ onClick={() => onDelete(policy)}
+ >
<Trash2Icon />
Delete Policy
</DropdownMenuItem>
@@ -233,9 +240,11 @@ type AlertRowProps = {
onView: () => void;
onEdit: () => void;
onDelete: () => void;
+ canEdit: boolean;
+ canDelete: boolean;
};
-const AlertRow = ({ alert, onView, onEdit, onDelete }: AlertRowProps) => {
+const AlertRow = ({ alert, onView, onEdit, onDelete, canEdit, canDelete }: AlertRowProps) => {
const { mutateAsync: updateAlert } = useUpdatePkiAlertV2();
const handleToggleAlert = async () => {
@@ -320,15 +329,15 @@ const AlertRow = ({ alert, onView, onEdit, onDelete }: AlertRowProps) => {
<EyeIcon />
View details
</DropdownMenuItem>
- <DropdownMenuItem onClick={onEdit}>
+ <DropdownMenuItem isDisabled={!canEdit} onClick={onEdit}>
<PencilIcon />
Edit alert
</DropdownMenuItem>
- <DropdownMenuItem onClick={handleToggleAlert}>
+ <DropdownMenuItem isDisabled={!canEdit} onClick={handleToggleAlert}>
{alert.enabled ? <CircleStopIcon /> : <PlayIcon />}
{alert.enabled ? "Disable" : "Enable"} alert
</DropdownMenuItem>
- <DropdownMenuItem variant="danger" onClick={onDelete}>
+ <DropdownMenuItem variant="danger" isDisabled={!canDelete} onClick={onDelete}>
<Trash2Icon />
Delete alert
</DropdownMenuItem>
@@ -340,10 +349,41 @@ const AlertRow = ({ alert, onView, onEdit, onDelete }: AlertRowProps) => {
};
export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
- const { permission } = useProjectPermission();
- const canManageProfileAttachments = permission.can(
- ProjectPermissionCertificateProfileActions.ManageApplicationAttachments,
- ProjectPermissionSub.CertificateProfiles
+ const { orgId, projectId } = useParams({ strict: false }) as {
+ orgId?: string;
+ projectId?: string;
+ };
+ const { data: permissionData } = useGetPkiApplicationPermissions(application.id);
+ const appAbility = permissionData?.permission;
+ const canManageProfileAttachments = Boolean(
+ appAbility?.can(
+ PkiApplicationResourceActions.ManageProfiles,
+ PkiApplicationResourceSub.Application
+ )
+ );
+ const canManagePolicies = Boolean(
+ appAbility?.can(
+ PkiApplicationResourceActions.Create,
+ PkiApplicationResourceSub.ApprovalPolicies
+ )
+ );
+ const canDeletePolicies = Boolean(
+ appAbility?.can(
+ PkiApplicationResourceActions.Delete,
+ PkiApplicationResourceSub.ApprovalPolicies
+ )
+ );
+ const canEditPolicies = Boolean(
+ appAbility?.can(PkiApplicationResourceActions.Edit, PkiApplicationResourceSub.ApprovalPolicies)
+ );
+ const canManageAlerts = Boolean(
+ appAbility?.can(PkiApplicationResourceActions.Create, PkiApplicationResourceSub.PkiAlerts)
+ );
+ const canEditAlerts = Boolean(
+ appAbility?.can(PkiApplicationResourceActions.Edit, PkiApplicationResourceSub.PkiAlerts)
+ );
+ const canDeleteAlerts = Boolean(
+ appAbility?.can(PkiApplicationResourceActions.Delete, PkiApplicationResourceSub.PkiAlerts)
);
const [isAttachOpen, setIsAttachOpen] = useState(false);
const [profilesToAttach, setProfilesToAttach] = useState<{ value: string; label: string }[]>([]);
@@ -422,12 +462,25 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
[profileList, attachedIds]
);
const totalProfileCount = profileList?.certificateProfiles?.length ?? 0;
- let attachDisabledReason: string | null = null;
+ let attachDisabledReason: ReactNode | null = null;
if (availableProfiles.length === 0) {
attachDisabledReason =
- totalProfileCount === 0
- ? "No certificate profiles exist yet. Create one in Certificate Manager → Policies first."
- : "All certificate profiles in this project are already attached.";
+ totalProfileCount === 0 ? (
+ <span>
+ No certificate profiles exist yet. Create one in{" "}
+ <Link
+ to="/organizations/$orgId/projects/cert-manager/$projectId/settings"
+ params={{ orgId: orgId ?? "", projectId: projectId ?? "" }}
+ search={{ selectedTab: "certificate-profiles" }}
+ className="text-primary underline hover:text-primary/80"
+ >
+ Certificate Profiles
+ </Link>{" "}
+ first.
+ </span>
+ ) : (
+ "All certificate profiles in this project are already attached."
+ );
}
const handleAttach = async () => {
@@ -471,8 +524,8 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
<CardHeader>
<CardTitle>Certificate Profiles</CardTitle>
<CardDescription>
- Attach the profiles this Application can issue from, then configure an enrollment method
- (API, EST, ACME, or SCEP) on each profile.
+ Configure how this Application enrolls against each attached profile (API, EST, ACME, or
+ SCEP).
</CardDescription>
{canManageProfileAttachments ? (
<CardAction>
@@ -588,7 +641,11 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
Approval workflows that gate certificate operations against this Application.
</CardDescription>
<CardAction>
- <Button variant="outline" onClick={() => handlePopUpOpen("policy")}>
+ <Button
+ variant="outline"
+ onClick={() => handlePopUpOpen("policy")}
+ isDisabled={!canManagePolicies}
+ >
<FontAwesomeIcon icon={faPlus} />
Create Policy
</Button>
@@ -599,6 +656,8 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
applicationId={application.id}
onEdit={(policy) => handlePopUpOpen("policy", { policyId: policy.id, policy })}
onDelete={(policy) => handlePopUpOpen("deletePolicy", { policyId: policy.id })}
+ canEdit={canEditPolicies}
+ canDelete={canDeletePolicies}
/>
</CardContent>
</Card>
@@ -610,7 +669,11 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
Alert rules for certificate events scoped to {application.name}.
</CardDescription>
<CardAction>
- <Button variant="outline" onClick={() => setAlertModal({ isOpen: true })}>
+ <Button
+ variant="outline"
+ onClick={() => setAlertModal({ isOpen: true })}
+ isDisabled={!canManageAlerts}
+ >
<FontAwesomeIcon icon={faPlus} />
Create Alert
</Button>
@@ -656,6 +719,8 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
onDelete={() =>
setDeleteAlertModal({ isOpen: true, alertId: a.id, name: a.name })
}
+ canEdit={canEditAlerts}
+ canDelete={canDeleteAlerts}
/>
))}
</TableBody>
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
index 5f0094dd7c..7b256e4105 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
@@ -12,6 +12,11 @@ import {
CardTitle,
PageLoader
} from "@app/components/v3";
+import {
+ PkiApplicationResourceActions,
+ PkiApplicationResourceSub,
+ useGetPkiApplicationPermissions
+} from "@app/hooks/api/pkiApplications";
import { useListPkiSyncs } from "@app/hooks/api/pkiSyncs";
import { PkiSyncsTable } from "../../IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable";
@@ -26,6 +31,14 @@ export const ApplicationSyncsTab = ({ applicationId, applicationName, projectId
refetchInterval: 30000
});
+ const { data: permissionData } = useGetPkiApplicationPermissions(applicationId);
+ const canCreateSync = Boolean(
+ permissionData?.permission?.can(
+ PkiApplicationResourceActions.Create,
+ PkiApplicationResourceSub.PkiSyncs
+ )
+ );
+
const applicationSyncs = useMemo(
() => (data ?? []).filter((sync) => sync.applicationId === applicationId),
[data, applicationId]
@@ -40,7 +53,11 @@ export const ApplicationSyncsTab = ({ applicationId, applicationName, projectId
and other destinations.
</CardDescription>
<CardAction>
- <Button variant="project" onClick={() => setIsAddSyncOpen(true)}>
+ <Button
+ variant="project"
+ onClick={() => setIsAddSyncOpen(true)}
+ isDisabled={!canCreateSync}
+ >
<PlusIcon />
Add Sync
</Button>
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
index c72c2aefa2..48ac2b3c00 100644
--- a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
@@ -1,9 +1,9 @@
+import { useState } from "react";
import { Helmet } from "react-helmet";
import { useNavigate, useParams } from "@tanstack/react-router";
-import { InfoIcon, MoreHorizontalIcon, PencilIcon, PlusIcon, Trash2Icon } from "lucide-react";
+import { InfoIcon, MoreHorizontalIcon, PlusIcon, SlidersHorizontalIcon } from "lucide-react";
-import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal, PageHeader } from "@app/components/v2";
+import { PageHeader } from "@app/components/v2";
import {
Button,
Card,
@@ -33,28 +33,23 @@ import {
TooltipTrigger
} from "@app/components/v3";
import { useProjectPermission } from "@app/context";
-import {
- TPkiApplication,
- useDeletePkiApplication,
- useListPkiApplications
-} from "@app/hooks/api/pkiApplications";
+import { TPkiApplication, useListPkiApplications } from "@app/hooks/api/pkiApplications";
import { ProjectType } from "@app/hooks/api/projects/types";
import { usePopUp } from "@app/hooks/usePopUp";
+import { ConfigureProfilesModal } from "./components/ConfigureProfilesModal";
import { PkiApplicationModal } from "./components/PkiApplicationModal";
export const ApplicationsPage = () => {
const { projectId, orgId } = useParams({ strict: false });
const navigate = useNavigate();
const { data: applications, isPending } = useListPkiApplications();
- const deleteApp = useDeletePkiApplication();
const { hasProjectRole } = useProjectPermission();
const canCreateApplication = hasProjectRole("admin");
+ const canConfigureProfiles = canCreateApplication;
+ const [configureProfilesApp, setConfigureProfilesApp] = useState<TPkiApplication | null>(null);
- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
- "application",
- "deleteApplication"
- ] as const);
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["application"] as const);
const renderApplications = () => {
if (isPending) {
@@ -123,34 +118,26 @@ export const ApplicationsPage = () => {
{new Date(app.createdAt).toLocaleDateString()}
</TableCell>
<TableCell>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton variant="ghost" size="xs" onClick={(e) => e.stopPropagation()}>
- <MoreHorizontalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent className="min-w-40" align="end" sideOffset={2}>
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("application", app);
- }}
- >
- <PencilIcon />
- Edit Application
- </DropdownMenuItem>
- <DropdownMenuItem
- variant="danger"
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteApplication", app);
- }}
- >
- <Trash2Icon />
- Delete Application
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ {canConfigureProfiles ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton variant="ghost" size="xs" onClick={(e) => e.stopPropagation()}>
+ <MoreHorizontalIcon />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent className="min-w-40" align="end" sideOffset={2}>
+ <DropdownMenuItem
+ onClick={(e) => {
+ e.stopPropagation();
+ setConfigureProfilesApp(app);
+ }}
+ >
+ <SlidersHorizontalIcon />
+ Configure Profiles
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null}
</TableCell>
</TableRow>
))}
@@ -194,23 +181,11 @@ export const ApplicationsPage = () => {
<PkiApplicationModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
- <DeleteActionModal
- isOpen={popUp.deleteApplication.isOpen}
- title={`Delete ${(popUp.deleteApplication.data as TPkiApplication | undefined)?.name ?? "Application"}?`}
- subTitle="This unattaches all Profiles, app-scoped syncs/alerts, and revokes app-only memberships. Issued certificates remain in the project but lose their Application tag."
- onChange={(isOpen) => handlePopUpToggle("deleteApplication", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={async () => {
- const app = popUp.deleteApplication.data as TPkiApplication | undefined;
- if (!app) return;
- try {
- await deleteApp.mutateAsync({ applicationId: app.id });
- createNotification({ type: "success", text: `Deleted ${app.name}` });
- handlePopUpClose("deleteApplication");
- } catch (err) {
- const detail = err instanceof Error ? err.message : "Failed to delete Application.";
- createNotification({ type: "error", text: detail });
- }
+ <ConfigureProfilesModal
+ application={configureProfilesApp}
+ isOpen={Boolean(configureProfilesApp)}
+ onOpenChange={(open) => {
+ if (!open) setConfigureProfilesApp(null);
}}
/>
</>
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/components/ConfigureProfilesModal.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/components/ConfigureProfilesModal.tsx
new file mode 100644
index 0000000000..b0c1f11b70
--- /dev/null
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/components/ConfigureProfilesModal.tsx
@@ -0,0 +1,117 @@
+import { useEffect, useMemo, useState } from "react";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ FilterableSelect
+} from "@app/components/v3";
+import { useListCertificateProfiles } from "@app/hooks/api/certificateProfiles";
+import {
+ TPkiApplication,
+ useAttachPkiApplicationProfiles,
+ useDetachPkiApplicationProfile,
+ useListPkiApplicationProfiles
+} from "@app/hooks/api/pkiApplications";
+
+type Option = { value: string; label: string };
+
+type Props = {
+ application: TPkiApplication | null;
+ isOpen: boolean;
+ onOpenChange: (open: boolean) => void;
+};
+
+export const ConfigureProfilesModal = ({ application, isOpen, onOpenChange }: Props) => {
+ const { data: profilesData } = useListCertificateProfiles({ limit: 100 });
+ const { data: attachedProfiles } = useListPkiApplicationProfiles(application?.id ?? "");
+
+ const attachProfiles = useAttachPkiApplicationProfiles();
+ const detachProfile = useDetachPkiApplicationProfile();
+
+ const profileOptions = useMemo<Option[]>(
+ () =>
+ (profilesData?.certificateProfiles ?? []).map((p) => ({
+ value: p.id,
+ label: p.slug
+ })),
+ [profilesData]
+ );
+
+ const initialOptions = useMemo<Option[]>(
+ () => (attachedProfiles ?? []).map((p) => ({ value: p.profileId, label: p.profileSlug })),
+ [attachedProfiles]
+ );
+
+ const [selected, setSelected] = useState<Option[]>(initialOptions);
+
+ useEffect(() => {
+ if (isOpen) setSelected(initialOptions);
+ }, [isOpen, initialOptions]);
+
+ const handleSave = async () => {
+ if (!application) return;
+ const nextIds = new Set(selected.map((o) => o.value));
+ const currentIds = new Set(initialOptions.map((o) => o.value));
+ const toAttach = [...nextIds].filter((id) => !currentIds.has(id));
+ const toDetach = [...currentIds].filter((id) => !nextIds.has(id));
+
+ if (toAttach.length === 0 && toDetach.length === 0) {
+ onOpenChange(false);
+ return;
+ }
+
+ try {
+ if (toAttach.length > 0) {
+ await attachProfiles.mutateAsync({ applicationId: application.id, profileIds: toAttach });
+ }
+ await Promise.all(
+ toDetach.map((profileId) =>
+ detachProfile.mutateAsync({ applicationId: application.id, profileId })
+ )
+ );
+ createNotification({ type: "success", text: "Profiles updated" });
+ onOpenChange(false);
+ } catch (err) {
+ const detail = err instanceof Error ? err.message : "Failed to update profiles.";
+ createNotification({ type: "error", text: detail });
+ }
+ };
+
+ const isPending = attachProfiles.isPending || detachProfile.isPending;
+
+ return (
+ <Dialog open={isOpen} onOpenChange={onOpenChange}>
+ <DialogContent className="max-w-md overflow-visible">
+ <DialogHeader>
+ <DialogTitle>Configure Profiles</DialogTitle>
+ <DialogDescription>
+ Select the certificate profiles attached to {application?.name ?? "this Application"}.
+ </DialogDescription>
+ </DialogHeader>
+ <div className="py-2">
+ <FilterableSelect
+ isMulti
+ value={selected}
+ onChange={(val) => setSelected((val ?? []) as Option[])}
+ options={profileOptions}
+ placeholder="Select profiles..."
+ />
+ </div>
+ <DialogFooter>
+ <Button variant="ghost" onClick={() => onOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button variant="project" onClick={handleSave} isPending={isPending}>
+ Save Changes
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx
index f7d0475b15..8656e99c3f 100644
--- a/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx
@@ -24,10 +24,7 @@ import {
import { useListCertificateProfiles } from "@app/hooks/api/certificateProfiles";
import {
TPkiApplication,
- useAttachPkiApplicationProfiles,
useCreatePkiApplication,
- useDetachPkiApplicationProfile,
- useListPkiApplicationProfiles,
useUpdatePkiApplication
} from "@app/hooks/api/pkiApplications";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -56,11 +53,8 @@ export const PkiApplicationModal = ({ popUp, handlePopUpToggle }: Props) => {
const editing = (popUp?.application?.data as TPkiApplication | undefined) ?? null;
const create = useCreatePkiApplication();
const update = useUpdatePkiApplication();
- const attachProfiles = useAttachPkiApplicationProfiles();
- const detachProfile = useDetachPkiApplicationProfile();
const { data: profilesData } = useListCertificateProfiles({ limit: 100 });
- const { data: attachedProfiles } = useListPkiApplicationProfiles(editing?.id ?? "");
const profileOptions = useMemo(
() =>
@@ -71,11 +65,6 @@ export const PkiApplicationModal = ({ popUp, handlePopUpToggle }: Props) => {
[profilesData]
);
- const initialAttachedOptions = useMemo(() => {
- if (!editing) return [];
- return (attachedProfiles ?? []).map((p) => ({ value: p.profileId, label: p.profileSlug }));
- }, [editing, attachedProfiles]);
-
const {
control,
handleSubmit,
@@ -91,43 +80,24 @@ export const PkiApplicationModal = ({ popUp, handlePopUpToggle }: Props) => {
reset({
name: editing.name,
description: editing.description ?? "",
- profileIds: initialAttachedOptions
+ profileIds: []
});
} else {
reset({ name: "", description: "", profileIds: [] });
}
- }, [editing, reset, initialAttachedOptions]);
+ }, [editing, reset]);
const onSubmit = async (data: FormData) => {
try {
- const selectedIds = (data.profileIds ?? []).map((p) => p.value);
if (editing) {
await update.mutateAsync({
applicationId: editing.id,
name: data.name,
description: data.description?.length ? data.description : null
});
-
- const currentIds = new Set(initialAttachedOptions.map((p) => p.value));
- const nextIds = new Set(selectedIds);
- const toAttach = selectedIds.filter((id) => !currentIds.has(id));
- const toDetach = [...currentIds].filter((id) => !nextIds.has(id));
-
- if (toAttach.length > 0) {
- await attachProfiles.mutateAsync({
- applicationId: editing.id,
- profileIds: toAttach
- });
- }
- // Detach mutations are independent — fire them in parallel.
- await Promise.all(
- toDetach.map((profileId) =>
- detachProfile.mutateAsync({ applicationId: editing.id, profileId })
- )
- );
-
createNotification({ type: "success", text: "Application updated" });
} else {
+ const selectedIds = (data.profileIds ?? []).map((p) => p.value);
await create.mutateAsync({
name: data.name,
description: data.description,
@@ -152,7 +122,7 @@ export const PkiApplicationModal = ({ popUp, handlePopUpToggle }: Props) => {
<DialogTitle>{editing ? "Edit Application" : "Create Application"}</DialogTitle>
<DialogDescription>
{editing
- ? "Update the Application's metadata and attached profiles. Changing the name will invalidate any deep links."
+ ? "Update this Application's name and description. Changing the name will invalidate any deep links."
: "A logical grouping for a service or workload that needs certificates. Each Application has its own members, profiles, and policies."}
</DialogDescription>
</DialogHeader>
@@ -187,32 +157,32 @@ export const PkiApplicationModal = ({ popUp, handlePopUpToggle }: Props) => {
</Field>
)}
/>
- <Controller
- control={control}
- name="profileIds"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Certificate Profiles</FieldLabel>
- <FieldContent>
- <FilterableSelect
- isMulti
- value={field.value ?? []}
- onChange={(val) =>
- field.onChange((val ?? []) as { value: string; label: string }[])
- }
- options={profileOptions}
- placeholder="Select profiles to attach..."
- />
- </FieldContent>
- <FieldDescription>
- {editing
- ? "Profiles this Application can issue from. Add or remove to update its attachments."
- : "Optionally attach existing profiles now. You can change this later."}
- </FieldDescription>
- {error ? <FieldError>{error.message}</FieldError> : null}
- </Field>
- )}
- />
+ {!editing ? (
+ <Controller
+ control={control}
+ name="profileIds"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel>Certificate Profiles</FieldLabel>
+ <FieldContent>
+ <FilterableSelect
+ isMulti
+ value={field.value ?? []}
+ onChange={(val) =>
+ field.onChange((val ?? []) as { value: string; label: string }[])
+ }
+ options={profileOptions}
+ placeholder="Select profiles to attach..."
+ />
+ </FieldContent>
+ <FieldDescription>
+ Optionally attach existing profiles now. You can change this later.
+ </FieldDescription>
+ {error ? <FieldError>{error.message}</FieldError> : null}
+ </Field>
+ )}
+ />
+ ) : null}
<DialogFooter>
<Button
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
index a62a2b862c..27c2a85988 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
@@ -565,28 +565,7 @@ export const CertificateIssuanceModal = ({
name="profileId"
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
<FormControl
- label={
- <div>
- <FormLabel
- isRequired
- label="Certificate Profile"
- icon={
- <Tooltip
- className="text-center"
- content={
- <span>
- Certificate profiles define the policies and enrollment methods
- for certificate issuance. The selected profile will enforce
- validation rules and determine the CA used for signing.
- </span>
- }
- >
- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />
- </Tooltip>
- }
- />
- </div>
- }
+ label="Certificate Profile"
errorText={error?.message}
isError={Boolean(error)}
isRequired
@@ -598,12 +577,20 @@ export const CertificateIssuanceModal = ({
className="w-full"
placeholder="Select a certificate profile"
position="popper"
+ dropdownContainerClassName="max-w-none"
>
- {availableProfiles.map((profile) => (
- <SelectItem key={profile.id} value={profile.id}>
- {profile.slug}
- </SelectItem>
- ))}
+ {availableProfiles.length === 0 && applicationId ? (
+ <div className="px-3 py-3 text-xs leading-snug whitespace-normal text-mineshaft-300">
+ Only profiles with API enrollment configured on this Application are
+ listed here. Configure API enrollment under the Settings tab.
+ </div>
+ ) : (
+ availableProfiles.map((profile) => (
+ <SelectItem key={profile.id} value={profile.id}>
+ {profile.slug}
+ </SelectItem>
+ ))
+ )}
</Select>
</FormControl>
)}
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateAuthorityOption.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateAuthorityOption.tsx
new file mode 100644
index 0000000000..35e45e53e4
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateAuthorityOption.tsx
@@ -0,0 +1,30 @@
+import { components, OptionProps } from "react-select";
+import { faPlus } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+export type CaOption =
+ | { id: string; name: string; groupType?: string }
+ | { id: "_create"; name: string };
+
+export const CertificateAuthorityOption = ({
+ isSelected,
+ children,
+ ...props
+}: OptionProps<CaOption>) => {
+ const isCreateOption = props.data.id === "_create";
+
+ return (
+ <components.Option isSelected={isSelected} {...props}>
+ <div className="flex items-center">
+ {isCreateOption ? (
+ <div className="flex items-center gap-x-1 text-mineshaft-400">
+ <FontAwesomeIcon icon={faPlus} size="sm" />
+ <span>Create New CA</span>
+ </div>
+ ) : (
+ <p className="mr-auto truncate">{children}</p>
+ )}
+ </div>
+ </components.Option>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx
index 75be970be4..55f3408541 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx
@@ -13,23 +13,17 @@ import {
} from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import {
- EnrollmentType,
TCertificateProfileWithDetails,
useDeleteCertificateProfile
} from "@app/hooks/api/certificateProfiles";
import { CreateProfileModal } from "./CreateProfileModal";
import { ProfileList } from "./ProfileList";
-import { RevealAcmeEabSecretModal } from "./RevealAcmeEabSecretModal";
-import { ScepDetailsModal } from "./ScepDetailsModal";
export const CertificateProfilesTab = () => {
const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
- const [isRevealProfileAcmeEabSecretModalOpen, setIsRevealProfileAcmeEabSecretModalOpen] =
- useState(false);
- const [isScepDetailsModalOpen, setIsScepDetailsModalOpen] = useState(false);
const [selectedProfile, setSelectedProfile] = useState<TCertificateProfileWithDetails | null>(
null
);
@@ -46,16 +40,6 @@ export const CertificateProfilesTab = () => {
setIsEditModalOpen(true);
};
- const handleRevealProfileAcmeEabSecret = (profile: TCertificateProfileWithDetails) => {
- setSelectedProfile(profile);
- setIsRevealProfileAcmeEabSecretModalOpen(true);
- };
-
- const handleViewScepDetails = (profile: TCertificateProfileWithDetails) => {
- setSelectedProfile(profile);
- setIsScepDetailsModalOpen(true);
- };
-
const handleDeleteProfile = (profile: TCertificateProfileWithDetails) => {
setSelectedProfile(profile);
setIsDeleteModalOpen(true);
@@ -107,12 +91,7 @@ export const CertificateProfilesTab = () => {
</ProjectPermissionCan>
</div>
- <ProfileList
- onEditProfile={handleEditProfile}
- onRevealProfileAcmeEabSecret={handleRevealProfileAcmeEabSecret}
- onViewScepDetails={handleViewScepDetails}
- onDeleteProfile={handleDeleteProfile}
- />
+ <ProfileList onEditProfile={handleEditProfile} onDeleteProfile={handleDeleteProfile} />
<CreateProfileModal isOpen={isCreateModalOpen} onClose={() => setIsCreateModalOpen(false)} />
<UpgradePlanModal
@@ -134,28 +113,6 @@ export const CertificateProfilesTab = () => {
mode="edit"
/>
- {selectedProfile.enrollmentType === EnrollmentType.ACME && (
- <RevealAcmeEabSecretModal
- isOpen={isRevealProfileAcmeEabSecretModalOpen}
- onClose={() => {
- setIsRevealProfileAcmeEabSecretModalOpen(false);
- setSelectedProfile(null);
- }}
- profile={selectedProfile}
- />
- )}
-
- {selectedProfile.enrollmentType === EnrollmentType.SCEP && (
- <ScepDetailsModal
- isOpen={isScepDetailsModalOpen}
- onClose={() => {
- setIsScepDetailsModalOpen(false);
- setSelectedProfile(null);
- }}
- profile={selectedProfile}
- />
- )}
-
<DeleteActionModal
isOpen={isDeleteModalOpen}
title={`Delete Certificate Profile ${selectedProfile.slug}?`}
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
index e3a95bea93..0610a8b1bf 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
@@ -6,6 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Tab } from "@headlessui/react";
import { zodResolver } from "@hookform/resolvers/zod";
import { useQueryClient } from "@tanstack/react-query";
+import { useNavigate, useParams } from "@tanstack/react-router";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
@@ -68,6 +69,7 @@ import {
} from "@app/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/shared/certificate-constants";
import { CreatePolicyModal } from "../CertificatePoliciesTab/CreatePolicyModal";
+import { CaOption, CertificateAuthorityOption } from "./CertificateAuthorityOption";
import { CertificatePolicyOption } from "./CertificatePolicyOption";
const certificateDefaultsSchema = z
@@ -583,6 +585,11 @@ interface Props {
export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }: Props) => {
const { currentProject } = useProject();
const { permission } = useProjectPermission();
+ const { orgId, projectId } = useParams({ strict: false }) as {
+ orgId?: string;
+ projectId?: string;
+ };
+ const navigate = useNavigate();
const { popUp, handlePopUpToggle, handlePopUpOpen } = usePopUp(["createPolicy"] as const);
const queryClient = useQueryClient();
@@ -1132,39 +1139,56 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
<Controller
control={control}
name="certificateAuthorityId"
- render={({ field: { onChange, value }, fieldState: { error } }) => (
- <FormControl
- label="Issuing CA"
- isRequired
- isError={Boolean(error)}
- errorText={error?.message}
- >
- <FilterableSelect
- value={certificateAuthorities.find((ca) => ca.id === value) || null}
- onChange={(selectedCaValue) => {
- if (Array.isArray(selectedCaValue)) {
- onChange(selectedCaValue[0]?.id || "");
- } else if (
- selectedCaValue &&
- typeof selectedCaValue === "object" &&
- "id" in selectedCaValue
- ) {
- onChange(selectedCaValue.id || "");
- } else {
- onChange("");
+ render={({ field: { onChange, value }, fieldState: { error } }) => {
+ const hasCas = certificateAuthorities.length > 0;
+ return (
+ <FormControl
+ label="Issuing CA"
+ isRequired
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <FilterableSelect
+ value={certificateAuthorities.find((ca) => ca.id === value) || null}
+ onChange={(selectedCaValue) => {
+ const selected = selectedCaValue as SingleValue<CaOption>;
+ if (selected?.id === "_create") {
+ navigate({
+ to: "/organizations/$orgId/projects/cert-manager/$projectId/settings",
+ params: { orgId: orgId ?? "", projectId: projectId ?? "" },
+ search: { selectedTab: "certificate-authorities" }
+ });
+ return;
+ }
+ if (Array.isArray(selectedCaValue)) {
+ onChange(selectedCaValue[0]?.id || "");
+ } else if (
+ selectedCaValue &&
+ typeof selectedCaValue === "object" &&
+ "id" in selectedCaValue
+ ) {
+ onChange(selectedCaValue.id || "");
+ } else {
+ onChange("");
+ }
+ }}
+ getOptionLabel={(ca) => ca.name}
+ getOptionValue={(ca) => ca.id}
+ options={
+ hasCas
+ ? certificateAuthorities
+ : ([{ id: "_create", name: "Create New CA" }] as CaOption[])
}
- }}
- getOptionLabel={(ca) => ca.name}
- getOptionValue={(ca) => ca.id}
- options={certificateAuthorities}
- groupBy="groupType"
- getGroupHeaderLabel={getGroupHeaderLabel}
- placeholder="Select a certificate authority"
- isDisabled={Boolean(isEdit)}
- className="w-full"
- />
- </FormControl>
- )}
+ groupBy={hasCas ? "groupType" : undefined}
+ getGroupHeaderLabel={hasCas ? getGroupHeaderLabel : undefined}
+ placeholder="Select a certificate authority"
+ isDisabled={Boolean(isEdit)}
+ className="w-full"
+ components={hasCas ? undefined : { Option: CertificateAuthorityOption }}
+ />
+ </FormControl>
+ );
+ }}
/>
)}
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileList.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileList.tsx
index 161ef0ed01..6750ba450d 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileList.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileList.tsx
@@ -20,16 +20,9 @@ import { ProfileRow } from "./ProfileRow";
interface Props {
onEditProfile: (profile: TCertificateProfileWithDetails) => void;
onDeleteProfile: (profile: TCertificateProfileWithDetails) => void;
- onRevealProfileAcmeEabSecret: (profile: TCertificateProfileWithDetails) => void;
- onViewScepDetails: (profile: TCertificateProfileWithDetails) => void;
}
-export const ProfileList = ({
- onEditProfile,
- onRevealProfileAcmeEabSecret,
- onViewScepDetails,
- onDeleteProfile
-}: Props) => {
+export const ProfileList = ({ onEditProfile, onDeleteProfile }: Props) => {
const { currentProject } = useProject();
const { data, isLoading } = useListCertificateProfiles({
@@ -47,7 +40,6 @@ export const ProfileList = ({
<THead>
<Tr>
<Th>Name</Th>
- <Th>Enrollment Method</Th>
<Th>Issuing CA</Th>
<Th>Certificate Policy</Th>
<Th className="w-5" />
@@ -55,7 +47,7 @@ export const ProfileList = ({
</THead>
<TBody>
<Tr>
- <Td colSpan={5}>
+ <Td colSpan={4}>
<EmptyState title="No Project Selected" />
</Td>
</Tr>
@@ -71,17 +63,16 @@ export const ProfileList = ({
<THead>
<Tr>
<Th>Name</Th>
- <Th>Enrollment Method</Th>
<Th>Issuing CA</Th>
<Th>Certificate Policy</Th>
<Th className="w-5" />
</Tr>
</THead>
<TBody>
- {isLoading && <TableSkeleton columns={5} innerKey="certificate-profiles" />}
+ {isLoading && <TableSkeleton columns={4} innerKey="certificate-profiles" />}
{!isLoading && (!profiles || profiles.length === 0) && (
<Tr>
- <Td colSpan={5}>
+ <Td colSpan={4}>
<EmptyState title="No Certificate Profiles" />
</Td>
</Tr>
@@ -94,8 +85,6 @@ export const ProfileList = ({
key={profile.id}
profile={profile}
onEditProfile={onEditProfile}
- onRevealProfileAcmeEabSecret={onRevealProfileAcmeEabSecret}
- onViewScepDetails={onViewScepDetails}
onDeleteProfile={onDeleteProfile}
/>
))}
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
index 5a42f5ec6c..d1d7edf15e 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
@@ -7,8 +7,6 @@ import {
faCopy,
faEdit,
faEllipsis,
- faEye,
- faPlus,
faTrash
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
@@ -24,41 +22,25 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { Badge } from "@app/components/v3";
import {
ProjectPermissionCertificateProfileActions,
ProjectPermissionSub
} from "@app/context/ProjectPermissionContext/types";
-import { usePopUp, useToggle } from "@app/hooks";
+import { useToggle } from "@app/hooks";
import { useGetInternalCaById } from "@app/hooks/api/ca/queries";
import { useGetCertificatePolicyById } from "@app/hooks/api/certificatePolicies";
-import {
- EnrollmentType,
- IssuerType,
- TCertificateProfile
-} from "@app/hooks/api/certificateProfiles";
-import { CertificateIssuanceModal } from "@app/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal";
+import { IssuerType, TCertificateProfile } from "@app/hooks/api/certificateProfiles";
interface Props {
profile: TCertificateProfile;
onEditProfile: (profile: TCertificateProfile) => void;
- onRevealProfileAcmeEabSecret: (profile: TCertificateProfile) => void;
- onViewScepDetails: (profile: TCertificateProfile) => void;
onDeleteProfile: (profile: TCertificateProfile) => void;
}
-export const ProfileRow = ({
- profile,
- onEditProfile,
- onRevealProfileAcmeEabSecret,
- onViewScepDetails,
- onDeleteProfile
-}: Props) => {
+export const ProfileRow = ({ profile, onEditProfile, onDeleteProfile }: Props) => {
const isInternalCa = !profile.certificateAuthority?.isExternal;
const { data: caData } = useGetInternalCaById(isInternalCa ? (profile.caId ?? "") : "");
- const { popUp, handlePopUpToggle } = usePopUp(["issueCertificate"] as const);
-
const [isIdCopied, setIsIdCopied] = useToggle(false);
const handleCopyId = useCallback(() => {
@@ -77,22 +59,6 @@ export const ProfileRow = ({
policyId: profile.certificatePolicyId
});
- const getEnrollmentTypeBadge = (enrollmentType: string) => {
- const config = {
- api: { variant: "ghost" as const, label: "API" },
- est: { variant: "ghost" as const, label: "EST" },
- acme: { variant: "ghost" as const, label: "ACME" },
- scep: { variant: "ghost" as const, label: "SCEP" }
- } as const;
-
- const configKey = Object.keys(config).includes(enrollmentType)
- ? (enrollmentType as keyof typeof config)
- : "api";
- const { variant, label } = config[configKey];
-
- return <Badge variant={variant}>{label}</Badge>;
- };
-
return (
<Tr key={profile.id} className="h-10 transition-colors duration-100 hover:bg-mineshaft-700">
<Td>
@@ -105,7 +71,6 @@ export const ProfileRow = ({
)}
</div>
</Td>
- <Td className="text-start">{getEnrollmentTypeBadge(profile.enrollmentType)}</Td>
<Td className="text-start">
<span className="text-sm text-mineshaft-300">
{profile.issuerType === IssuerType.SELF_SIGNED
@@ -156,66 +121,6 @@ export const ProfileRow = ({
)
}
</ProjectPermissionCan>
- {profile.enrollmentType === EnrollmentType.ACME && (
- <ProjectPermissionCan
- I={ProjectPermissionCertificateProfileActions.RevealAcmeEabSecret}
- a={subject(ProjectPermissionSub.CertificateProfiles, { slug: profile.slug })}
- >
- {(isAllowed) =>
- isAllowed && (
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- onRevealProfileAcmeEabSecret(profile);
- }}
- icon={<FontAwesomeIcon icon={faEye} className="w-3" />}
- >
- Reveal ACME EAB
- </DropdownMenuItem>
- )
- }
- </ProjectPermissionCan>
- )}
- {profile.enrollmentType === EnrollmentType.SCEP && (
- <ProjectPermissionCan
- I={ProjectPermissionCertificateProfileActions.Read}
- a={subject(ProjectPermissionSub.CertificateProfiles, { slug: profile.slug })}
- >
- {(isAllowed) =>
- isAllowed && (
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- onViewScepDetails(profile);
- }}
- icon={<FontAwesomeIcon icon={faEye} className="w-3" />}
- >
- View SCEP Details
- </DropdownMenuItem>
- )
- }
- </ProjectPermissionCan>
- )}
- {profile.enrollmentType === EnrollmentType.API && (
- <ProjectPermissionCan
- I={ProjectPermissionCertificateProfileActions.IssueCert}
- a={subject(ProjectPermissionSub.CertificateProfiles, { slug: profile.slug })}
- >
- {(isAllowed) =>
- isAllowed && (
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpToggle("issueCertificate");
- }}
- icon={<FontAwesomeIcon icon={faPlus} className="w-3" />}
- >
- Request Certificate
- </DropdownMenuItem>
- )
- }
- </ProjectPermissionCan>
- )}
<ProjectPermissionCan
I={ProjectPermissionCertificateProfileActions.Delete}
a={subject(ProjectPermissionSub.CertificateProfiles, { slug: profile.slug })}
@@ -236,11 +141,6 @@ export const ProfileRow = ({
</ProjectPermissionCan>
</DropdownMenuContent>
</DropdownMenu>
- <CertificateIssuanceModal
- popUp={popUp}
- handlePopUpToggle={handlePopUpToggle}
- profileId={profile.id}
- />
</Td>
</Tr>
);
diff --git a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
index b1c1a86199..2b0e49e048 100644
--- a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
+++ b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
@@ -224,7 +224,7 @@ export const RequestsPage = () => {
<PageHeader
scope={ProjectType.CertificateManager}
title="Requests"
- description="Certificate approval requests across every Application. Use this inbox to approve, reject, or follow up on pending issuance."
+ description="Pending approval requests for certificate issuance and code signing. Use this inbox to approve, reject, or follow up on requests from your Applications and Signers."
/>
<Tabs
diff --git a/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx b/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx
index 64b70c8f23..a649ba7097 100644
--- a/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx
@@ -21,7 +21,7 @@ export const SettingsPage = () => {
const search = useSearch({ strict: false }) as { selectedTab?: string };
const navigate = useNavigate();
const { currentProject } = useProject();
- const activeTab = search.selectedTab ?? "certificate-authorities";
+ const activeTab = search.selectedTab ?? "certificate-profiles";
return (
<div className="flex h-full w-full justify-center bg-bunker-800 text-white">
@@ -46,15 +46,15 @@ export const SettingsPage = () => {
}
>
<TabList>
- <Tab variant="project" value="certificate-authorities">
- Certificate Authorities
- </Tab>
<Tab variant="project" value="certificate-profiles">
Certificate Profiles
</Tab>
<Tab variant="project" value="certificate-policies">
Certificate Policies
</Tab>
+ <Tab variant="project" value="certificate-authorities">
+ Certificate Authorities
+ </Tab>
<Tab variant="project" value="app-connections">
App Connections
</Tab>
diff --git a/frontend/src/pages/cert-manager/SettingsPage/route.tsx b/frontend/src/pages/cert-manager/SettingsPage/route.tsx
index d478694390..f3c2ea3cda 100644
--- a/frontend/src/pages/cert-manager/SettingsPage/route.tsx
+++ b/frontend/src/pages/cert-manager/SettingsPage/route.tsx
@@ -5,7 +5,7 @@ import { z } from "zod";
import { SettingsPage } from "./SettingsPage";
const settingsPageSearchSchema = z.object({
- selectedTab: z.string().optional().default("certificate-authorities")
+ selectedTab: z.string().optional().default("certificate-profiles")
});
export const Route = createFileRoute(
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsTable.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsTable.tsx
index d4a5d4dd49..5e25cbdabd 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsTable.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsTable.tsx
@@ -27,6 +27,7 @@ import { usePagination, useResetPageHelper } from "@app/hooks";
import { useListGroupProjects } from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
import { FilterReturnedProjects } from "@app/hooks/api/groups/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { GroupProjectRow } from "./GroupProjectRow";
@@ -85,7 +86,9 @@ export const GroupProjectsTable = ({
});
const totalCount = groupMemberships?.totalCount ?? 0;
- const projects = groupMemberships?.projects ?? [];
+ const projects = (groupMemberships?.projects ?? []).filter(
+ (p) => p.type !== ProjectType.CertificateManager
+ );
useResetPageHelper({
totalCount,
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsTable.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsTable.tsx
index c521acc3aa..de8bd6bde4 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsTable.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectsTable.tsx
@@ -27,6 +27,7 @@ import {
import { usePagination, useResetPageHelper } from "@app/hooks";
import { useGetIdentityProjectMemberships } from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { IdentityProjectRow } from "./IdentityProjectRow";
@@ -67,9 +68,16 @@ export const IdentityProjectsTable = ({ identityId, handlePopUpOpen }: Props) =>
setUserTablePreference("identityProjectsTable", PreferenceKey.PerPage, newPerPage);
};
+ const visibleProjectMemberships = useMemo(
+ () =>
+ projectMemberships?.filter(
+ (membership) => membership.project.type !== ProjectType.CertificateManager
+ ),
+ [projectMemberships]
+ );
const filteredProjectMemberships = useMemo(
() =>
- projectMemberships
+ visibleProjectMemberships
?.filter((membership) =>
membership.project.name.toLowerCase().includes(search.trim().toLowerCase())
)
@@ -81,7 +89,7 @@ export const IdentityProjectsTable = ({ identityId, handlePopUpOpen }: Props) =>
.toLowerCase()
.localeCompare(membershipTwo.project.name.toLowerCase());
}),
- [projectMemberships, orderDirection, search]
+ [visibleProjectMemberships, orderDirection, search]
);
useResetPageHelper({
@@ -143,16 +151,16 @@ export const IdentityProjectsTable = ({ identityId, handlePopUpOpen }: Props) =>
<Empty className="border">
<EmptyHeader>
<EmptyTitle>
- {projectMemberships.length
+ {visibleProjectMemberships.length
? "No projects match this search"
: "This machine identity is not a member of any projects"}
</EmptyTitle>
<EmptyDescription>
- {projectMemberships.length
+ {visibleProjectMemberships.length
? "Adjust search filters to view project memberships."
: "Assign this machine identity to a project."}
</EmptyDescription>
- {!projectMemberships.length && (
+ {!visibleProjectMemberships.length && (
<EmptyContent>
<Button
variant={isSubOrganization ? "sub-org" : "org"}
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsTable.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsTable.tsx
index ebc0f27057..52751ba847 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsTable.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsTable.tsx
@@ -27,6 +27,7 @@ import {
import { usePagination, useResetPageHelper } from "@app/hooks";
import { useGetOrgMembershipProjectMemberships } from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { UserProjectRow } from "./UserProjectRow";
@@ -77,9 +78,16 @@ export const UserProjectsTable = ({
membershipId
);
+ const visibleProjectMemberships = useMemo(
+ () =>
+ projectMemberships?.filter(
+ (membership) => membership.project.type !== ProjectType.CertificateManager
+ ),
+ [projectMemberships]
+ );
const filteredProjectMemberships = useMemo(
() =>
- projectMemberships
+ visibleProjectMemberships
?.filter((membership) =>
membership.project.name.toLowerCase().includes(search.trim().toLowerCase())
)
@@ -91,7 +99,7 @@ export const UserProjectsTable = ({
.toLowerCase()
.localeCompare(membershipTwo.project.name.toLowerCase());
}),
- [projectMemberships, orderDirection, search]
+ [visibleProjectMemberships, orderDirection, search]
);
useResetPageHelper({
@@ -149,16 +157,16 @@ export const UserProjectsTable = ({
<Empty className="border">
<EmptyHeader>
<EmptyTitle>
- {projectMemberships.length
+ {visibleProjectMemberships.length
? "No projects match this search"
: "This user is not a member of any projects"}
</EmptyTitle>
<EmptyDescription>
- {projectMemberships.length
+ {visibleProjectMemberships.length
? "Adjust search filters to view project memberships."
: "Assign this user to a project."}
</EmptyDescription>
- {!projectMemberships.length && canAddToProject && (
+ {!visibleProjectMemberships.length && canAddToProject && (
<EmptyContent>
<Button
variant={isSubOrganization ? "sub-org" : "org"}
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
index ce05d29f1c..3313a1f0dc 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupModal.tsx
@@ -5,6 +5,7 @@ import { Link } from "@tanstack/react-router";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
+import { RoleOption } from "@app/components/roles";
import { Button, FilterableSelect, FormControl, Modal, ModalContent } from "@app/components/v2";
import { useOrganization, useProject } from "@app/context";
import {
@@ -117,6 +118,7 @@ const Content = ({ popUp, handlePopUpToggle }: Props) => {
getOptionLabel={(option) => option.name}
options={roles}
placeholder="Select role..."
+ components={{ Option: RoleOption }}
/>
</FormControl>
)}
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal.tsx
index b2e5194d01..8f2ef734ea 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal.tsx
@@ -6,6 +6,7 @@ import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
+import { RoleOption } from "@app/components/roles";
import {
Button,
FilterableSelect,
@@ -222,6 +223,7 @@ export const ProjectIdentityModal = ({ onClose, identity }: ContentProps) => {
value={value}
getOptionValue={(option) => option.slug}
getOptionLabel={(option) => option.name}
+ components={{ Option: RoleOption }}
/>
</FormControl>
)}
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
index 29c7615fd5..75c2937cf8 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
@@ -196,31 +196,33 @@ export const Page = () => {
>
Copy User ID
</DropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionMemberActions.AssumePrivileges}
- a={ProjectPermissionSub.Member}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- onClick={() =>
- handlePopUpOpen("assumePrivileges", {
- userId: membershipDetails.user.id
- })
- }
- >
- Assume Privileges
- <Tooltip
- side="bottom"
- content="Assume the privileges of this user, allowing you to replicate their access behavior."
+ {!isCertManager && (
+ <ProjectPermissionCan
+ I={ProjectPermissionMemberActions.AssumePrivileges}
+ a={ProjectPermissionSub.Member}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ isDisabled={!isAllowed}
+ onClick={() =>
+ handlePopUpOpen("assumePrivileges", {
+ userId: membershipDetails.user.id
+ })
+ }
>
- <div>
- <InfoIcon className="text-muted" />
- </div>
- </Tooltip>
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
+ Assume Privileges
+ <Tooltip
+ side="bottom"
+ content="Assume the privileges of this user, allowing you to replicate their access behavior."
+ >
+ <div>
+ <InfoIcon className="text-muted" />
+ </div>
+ </Tooltip>
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ )}
<ProjectPermissionCan
I={ProjectPermissionMemberActions.Delete}
a={ProjectPermissionSub.Member}
@@ -231,7 +233,9 @@ export const Page = () => {
isDisabled={!isAllowed}
onClick={() => handlePopUpOpen("removeMember")}
>
- Remove User From Project
+ {isCertManager
+ ? "Remove User From Certificate Manager"
+ : "Remove User From Project"}
</DropdownMenuItem>
)}
</ProjectPermissionCan>