Skip to content

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

PKI improvements on request access and UI nits

Carlos Monastyrski58e93ac3eead
diff --git a/backend/src/db/migrations/20260504432352_cert-manager-applications.ts b/backend/src/db/migrations/20260504432352_cert-manager-applications.ts
index bdd12a0453..9b0484846b 100644
--- a/backend/src/db/migrations/20260504432352_cert-manager-applications.ts
+++ b/backend/src/db/migrations/20260504432352_cert-manager-applications.ts
@@ -6,13 +6,8 @@ import { alphaNumericNanoId } from "@app/lib/nanoid";
import { TableName } from "../schemas";
import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
-const ACCESS_SCOPE_PROJECT = "project";
-const ACCESS_SCOPE_ORGANIZATION = "organization";
const PROJECT_TYPE_CERT_MANAGER = "cert-manager";
const PROJECT_VERSION_V3 = 3;
-const PROJECT_MEMBERSHIP_ROLE_ADMIN = "admin";
-const ORG_MEMBERSHIP_ROLE_ADMIN = "admin";
-const ORG_MEMBERSHIP_ROLE_OWNER = "owner";
const PIT_VERSION_LIMIT_DEFAULT = 10;
const BACKFILL_CHUNK_SIZE = 8;
@@ -33,36 +28,6 @@ const backfillOrgCertManagerProject = async (knex: Knex, orgId: string) => {
.returning("id")) as Array<{ id: string }>;
await tx(TableName.Organization).where("id", orgId).update({ defaultCertManagerProjectId: projectId });
-
- // Promote every existing org admin / owner to project admin so they can manage the new project.
- const orgAdminMemberships = (await tx(TableName.Membership)
- .join(TableName.MembershipRole, `${TableName.MembershipRole}.membershipId`, `${TableName.Membership}.id`)
- .where(`${TableName.Membership}.scope`, ACCESS_SCOPE_ORGANIZATION)
- .where(`${TableName.Membership}.scopeOrgId`, orgId)
- .whereNotNull(`${TableName.Membership}.actorUserId`)
- .whereIn(`${TableName.MembershipRole}.role`, [ORG_MEMBERSHIP_ROLE_ADMIN, ORG_MEMBERSHIP_ROLE_OWNER])
- .distinct(`${TableName.Membership}.actorUserId as actorUserId`)) as Array<{ actorUserId: string }>;
-
- if (orgAdminMemberships.length === 0) return;
-
- const insertedMemberships = (await tx(TableName.Membership)
- .insert(
- orgAdminMemberships.map((m) => ({
- scope: ACCESS_SCOPE_PROJECT,
- scopeOrgId: orgId,
- scopeProjectId: projectId,
- actorUserId: m.actorUserId,
- isActive: true
- }))
- )
- .returning("id")) as Array<{ id: string }>;
-
- await tx(TableName.MembershipRole).insert(
- insertedMemberships.map(({ id: membershipId }) => ({
- membershipId,
- role: PROJECT_MEMBERSHIP_ROLE_ADMIN
- }))
- );
});
};
diff --git a/backend/src/server/routes/v1/certificate-policy-router.ts b/backend/src/server/routes/v1/certificate-policy-router.ts
index 27348821a2..59fe5a47e8 100644
--- a/backend/src/server/routes/v1/certificate-policy-router.ts
+++ b/backend/src/server/routes/v1/certificate-policy-router.ts
@@ -270,13 +270,14 @@ export const registerCertificatePolicyRouter = async (server: FastifyZodProvider
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
+ const projectId = req.internalCertManagerProjectId;
const { policies, totalCount } = await server.services.certificatePolicy.listPolicies({
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod!,
actorOrgId: req.permission.orgId,
...req.query,
- projectId: req.internalCertManagerProjectId
+ projectId
});
await server.services.auditLog.createAuditLog({
diff --git a/backend/src/server/routes/v1/pki-application-membership-routers/users-router.ts b/backend/src/server/routes/v1/pki-application-membership-routers/users-router.ts
index 4df429a4a2..b8f92aac3d 100644
--- a/backend/src/server/routes/v1/pki-application-membership-routers/users-router.ts
+++ b/backend/src/server/routes/v1/pki-application-membership-routers/users-router.ts
@@ -1,5 +1,6 @@
import { z } from "zod";
+import { AccessScope, ProjectMembershipRole } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -14,6 +15,27 @@ const UserParamsSchema = z.object({
userId: z.string().uuid()
});
+const AddUsersBodySchema = z
+ .object({
+ userIds: z.string().uuid().array().default([]),
+ emails: z
+ .string()
+ .email()
+ .array()
+ .default([])
+ .refine((val) => val.every((el) => el === el.toLowerCase()), "Email must be lowercase"),
+ role: z.string().min(1).default("operator")
+ })
+ .refine((val) => val.userIds.length + val.emails.length > 0, {
+ message: "Provide at least one userId or email."
+ });
+
+const AddUsersResponseSchema = z.object({
+ memberships: z.array(ApplicationMemberSchema),
+ skipped: z.array(z.string()),
+ unresolved: z.array(z.string())
+});
+
export const registerPkiApplicationUserMembershipRouter = async (server: FastifyZodProvider) => {
server.route({
method: "GET",
@@ -54,45 +76,70 @@ export const registerPkiApplicationUserMembershipRouter = async (server: Fastify
server.route({
method: "POST",
- url: "/:applicationId/users/:userId",
+ url: "/:applicationId/users",
config: { rateLimit: writeLimit },
schema: {
hide: false,
- operationId: "addPkiApplicationUserMember",
- description: "Add a user as a member of a Cert Manager application.",
+ operationId: "addPkiApplicationUserMembers",
+ description:
+ "Add user members to a Cert Manager application by userId, email, or username. Bootstraps org and project membership for users not already present, then attaches them to the application.",
tags: [ApiDocsTags.PkiApplications],
- params: UserParamsSchema,
- body: RoleBodySchema,
- response: { 200: z.object({ membership: ApplicationMemberSchema }) }
+ params: ApplicationIdParamsSchema,
+ body: AddUsersBodySchema,
+ response: { 200: AddUsersResponseSchema }
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
- const membership = await server.services.pkiApplicationMembership.addMember({
+ const projectId = req.internalCertManagerProjectId;
+ const { emails } = req.body;
+
+ if (emails.length > 0) {
+ await server.services.membershipUser.createMembership({
+ permission: req.permission,
+ scopeData: { scope: AccessScope.Organization, orgId: req.permission.orgId },
+ data: { roles: [], usernames: emails }
+ });
+
+ await server.services.membershipUser.createMembership({
+ permission: req.permission,
+ scopeData: { scope: AccessScope.Project, orgId: req.permission.orgId, projectId },
+ data: {
+ roles: [{ isTemporary: false, role: ProjectMembershipRole.Member }],
+ usernames: emails
+ }
+ });
+ }
+
+ const result = await server.services.pkiApplicationMembership.addUserMembers({
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId,
- projectId: req.internalCertManagerProjectId,
+ projectId,
applicationId: req.params.applicationId,
- userId: req.params.userId,
+ userIds: req.body.userIds,
+ emails,
role: req.body.role
});
- await server.services.auditLog.createAuditLog({
- ...req.auditLogInfo,
- projectId: req.internalCertManagerProjectId,
- event: {
- type: EventType.ADD_PKI_APPLICATION_MEMBER,
- metadata: {
- applicationId: membership.applicationId,
- membershipId: membership.membershipId,
- userId: membership.actorUserId ?? undefined,
- role: membership.role
+ for (const m of result.memberships) {
+ // eslint-disable-next-line no-await-in-loop
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId,
+ event: {
+ type: EventType.ADD_PKI_APPLICATION_MEMBER,
+ metadata: {
+ applicationId: req.params.applicationId,
+ membershipId: m.membershipId,
+ userId: m.actorUserId ?? undefined,
+ role: m.role
+ }
}
- }
- });
+ });
+ }
- return { membership };
+ return result;
}
});
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 cd086c9e81..80ff154487 100644
--- a/backend/src/services/pki-application/pki-application-membership-service.ts
+++ b/backend/src/services/pki-application/pki-application-membership-service.ts
@@ -17,6 +17,7 @@ import { TUserDALFactory } from "../user/user-dal";
import { TPkiApplicationDALFactory } from "./pki-application-dal";
import {
TAddApplicationMemberDTO,
+ TAddApplicationUserMembersDTO,
TApplicationMember,
TListApplicationMembersDTO,
TRemoveApplicationMemberDTO,
@@ -399,5 +400,95 @@ export const pkiApplicationMembershipServiceFactory = ({
return { membershipId: membership.id, applicationId };
};
- return { addMember, listMembers, updateMemberRole, removeMember };
+ const addUserMembers = async ({
+ applicationId,
+ projectId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId,
+ userIds,
+ emails,
+ role
+ }: TAddApplicationUserMembersDTO): Promise<{
+ memberships: TApplicationMember[];
+ skipped: string[];
+ unresolved: string[];
+ }> => {
+ if (!isBuiltInApplicationRole(role)) {
+ throw new BadRequestError({
+ message: `Unknown application role '${role}'. Expected one of: admin, operator, auditor.`
+ });
+ }
+
+ await $loadApplicationOrThrow(applicationId, projectId);
+
+ const { permission } = await $loadResourcePermission(applicationId, projectId, {
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ResourcePermissionApplicationActions.Edit,
+ ResourcePermissionSub.Application
+ );
+ ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionMemberActions.Create, ResourcePermissionSub.Member);
+
+ const usersByEmail = emails.length ? await userDAL.find({ $in: { username: emails } }) : [];
+ const userByEmail = new Map<string, (typeof usersByEmail)[number]>();
+ for (const u of usersByEmail) userByEmail.set(u.username, u);
+ const unresolved = emails.filter((e) => !userByEmail.has(e));
+
+ const existing = await membershipDAL.find({
+ scope: RESOURCE_SCOPE,
+ scopeProjectId: projectId,
+ scopeResourceType: ResourceType.CertificateApplication,
+ scopeResourceId: applicationId
+ });
+ const alreadyAttached = new Set<string>(existing.map((m) => m.actorUserId).filter((v): v is string => Boolean(v)));
+
+ const targets: { userId: string; label: string }[] = [];
+ const seen = new Set<string>();
+ userIds.forEach((id) => {
+ if (!seen.has(id)) {
+ seen.add(id);
+ targets.push({ userId: id, label: id });
+ }
+ });
+ emails.forEach((email) => {
+ const user = userByEmail.get(email);
+ if (user && !seen.has(user.id)) {
+ seen.add(user.id);
+ targets.push({ userId: user.id, label: email });
+ }
+ });
+
+ const memberships: TApplicationMember[] = [];
+ const skipped: string[] = [];
+ for (const t of targets) {
+ if (alreadyAttached.has(t.userId)) {
+ skipped.push(t.label);
+ } else {
+ // eslint-disable-next-line no-await-in-loop
+ const m = await addMember({
+ applicationId,
+ userId: t.userId,
+ role,
+ projectId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ });
+ memberships.push(m);
+ alreadyAttached.add(t.userId);
+ }
+ }
+
+ return { memberships, skipped, unresolved };
+ };
+
+ return { addMember, addUserMembers, listMembers, updateMemberRole, removeMember };
};
diff --git a/backend/src/services/pki-application/pki-application-types.ts b/backend/src/services/pki-application/pki-application-types.ts
index 7f3529fff3..4071c88c18 100644
--- a/backend/src/services/pki-application/pki-application-types.ts
+++ b/backend/src/services/pki-application/pki-application-types.ts
@@ -115,3 +115,10 @@ export type TRemoveApplicationMemberDTO = {
kind: TApplicationMemberKind;
memberId: string;
} & TProjectPermission;
+
+export type TAddApplicationUserMembersDTO = {
+ applicationId: string;
+ userIds: string[];
+ emails: string[];
+ role: string;
+} & TProjectPermission;
diff --git a/frontend/src/components/projects/RequestProjectAccessModal.tsx b/frontend/src/components/projects/RequestProjectAccessModal.tsx
index 6d31bf8e62..c39d216500 100644
--- a/frontend/src/components/projects/RequestProjectAccessModal.tsx
+++ b/frontend/src/components/projects/RequestProjectAccessModal.tsx
@@ -59,21 +59,28 @@ type RequestProjectAccessModalProps = {
onOpenChange: (isOpen: boolean) => void;
project?: Project;
onComplete?: () => void;
+ title?: string;
+ subTitle?: string;
};
export const RequestProjectAccessModal = ({
isOpen,
onOpenChange,
project,
- onComplete
+ onComplete,
+ title = "Confirm Access Request",
+ subTitle
}: RequestProjectAccessModalProps) => {
if (!project) return null;
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
<ModalContent
- title="Confirm Access Request"
- subTitle={`Requesting access to project ${project?.name}. You may include an optional note for project admins to review your request.`}
+ title={title}
+ subTitle={
+ subTitle ??
+ `Requesting access to project ${project?.name}. You may include an optional note for project admins to review your request.`
+ }
>
<Content
onComplete={() => {
diff --git a/frontend/src/hooks/api/pkiApplications/mutations.ts b/frontend/src/hooks/api/pkiApplications/mutations.ts
index 0f16419c06..42132fcd1c 100644
--- a/frontend/src/hooks/api/pkiApplications/mutations.ts
+++ b/frontend/src/hooks/api/pkiApplications/mutations.ts
@@ -114,6 +114,35 @@ export const useAddPkiApplicationMember = () => {
});
};
+export const useAddPkiApplicationUserMembers = () => {
+ const qc = useQueryClient();
+ return useMutation({
+ mutationFn: async ({
+ applicationId,
+ userIds,
+ emails,
+ role
+ }: {
+ applicationId: string;
+ userIds?: string[];
+ emails?: string[];
+ role: string;
+ }) => {
+ const { data } = await apiRequest.post<{
+ memberships: TPkiApplicationMember[];
+ skipped: string[];
+ unresolved: string[];
+ }>(`${BASE_URL}/${applicationId}/users`, {
+ userIds: userIds ?? [],
+ emails: emails ?? [],
+ role
+ });
+ return data;
+ },
+ onSuccess: () => invalidateAll(qc)
+ });
+};
+
export const useUpdatePkiApplicationMemberRole = () => {
const qc = useQueryClient();
return useMutation({
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
index 62dba7e402..8bc53fb5ed 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
@@ -20,14 +20,17 @@ import {
SelectTrigger,
SelectValue
} from "@app/components/v3";
-import { apiRequest } from "@app/config/request";
import { useOrganization } from "@app/context";
import {
useGetIdentityMembershipOrgs,
useGetOrganizationGroups
} from "@app/hooks/api/organization";
import { useCreateOrgIdentity } from "@app/hooks/api/orgIdentity";
-import { TPkiApplicationMember, useAddPkiApplicationMember } from "@app/hooks/api/pkiApplications";
+import {
+ TPkiApplicationMember,
+ useAddPkiApplicationMember,
+ useAddPkiApplicationUserMembers
+} from "@app/hooks/api/pkiApplications";
import {
useCreateProjectIdentityMembership,
useListProjectIdentityMemberships
@@ -52,10 +55,6 @@ const APP_ROLES = [
{ slug: "auditor", label: "Auditor" }
];
-type CertManagerInviteResponse = {
- memberships: Array<{ id: string; userId: string }>;
-};
-
const runSequential = async <T,>(items: T[], fn: (item: T) => Promise<void>): Promise<void> => {
await items.reduce<Promise<void>>(async (prev, item) => {
await prev;
@@ -108,6 +107,7 @@ export const AddApplicationMemberModal = ({
}, [projectIdentitiesQuery.data]);
const addMember = useAddPkiApplicationMember();
+ const addUserMembers = useAddPkiApplicationUserMembers();
const createIdentity = useCreateOrgIdentity();
const addIdentityToProject = useCreateProjectIdentityMembership();
@@ -164,52 +164,27 @@ export const AddApplicationMemberModal = ({
const submitUsers = async () => {
if (selectedUsers.length === 0) return;
- const orgUsers = usersQuery.data ?? [];
- const existing = selectedUsers.filter((u) => !u.isNew);
- const newInviteEmails = selectedUsers.filter((u) => u.isNew).map((u) => u.value);
-
- if (newInviteEmails.length > 0 || existing.length > 0) {
- const usernames = [
- ...newInviteEmails,
- ...existing
- .map((u) => {
- const o = orgUsers.find((x) => x.user.id === u.value);
- return o?.user.username || o?.user.email || null;
- })
- .filter((x): x is string => Boolean(x))
- ];
- await apiRequest.post<CertManagerInviteResponse>("/api/v1/cert-manager/access/users", {
- usernames,
- roleSlugs: ["member"]
- });
- }
const userIds: string[] = [];
- existing.forEach((u) => userIds.push(u.value));
- if (newInviteEmails.length > 0) {
- const refreshed = (await usersQuery.refetch()).data ?? [];
- const unresolved: string[] = [];
- newInviteEmails.forEach((email) => {
- const fromOrg = refreshed.find(
- (o) => o.user.email === email || o.user.username === email || o.inviteEmail === email
- );
- if (fromOrg?.user.id) {
- userIds.push(fromOrg.user.id);
- return;
- }
- unresolved.push(email);
- });
- if (unresolved.length > 0) {
- createNotification({
- type: "warning",
- text: `Invited ${unresolved.length === 1 ? "user" : "users"} but couldn't add to the Application yet: ${unresolved.join(", ")}. Refresh and add them once they appear in the org.`
- });
- }
- }
+ const emails: string[] = [];
+ selectedUsers.forEach((u) => {
+ if (u.isNew) emails.push(u.value);
+ else userIds.push(u.value);
+ });
- await runSequential(userIds, async (userId) => {
- await addMember.mutateAsync({ applicationId, kind: "user", memberId: userId, role });
+ const result = await addUserMembers.mutateAsync({
+ applicationId,
+ userIds,
+ emails,
+ role
});
+
+ if (result.unresolved.length > 0) {
+ createNotification({
+ type: "warning",
+ text: `Couldn't resolve ${result.unresolved.length === 1 ? "user" : "users"}: ${result.unresolved.join(", ")}. They were invited to the org but not yet attached to the Application.`
+ });
+ }
};
const submitIdentities = async () => {
diff --git a/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsx b/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsx
index bb1d2d36c6..05290808c5 100644
--- a/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsx
+++ b/frontend/src/pages/organization/ProjectsPage/components/ProjectCategoryOverview.tsx
@@ -1,7 +1,9 @@
-import { useMemo } from "react";
+import { useMemo, useState } from "react";
import { useNavigate } from "@tanstack/react-router";
-import { Lottie } from "@app/components/v2";
+import { createNotification } from "@app/components/notifications";
+import { RequestProjectAccessModal } from "@app/components/projects/RequestProjectAccessModal";
+import { Button, Lottie, Modal, ModalClose, ModalContent } from "@app/components/v2";
import {
Card,
CardContent,
@@ -10,7 +12,11 @@ import {
CardTitle,
Skeleton
} from "@app/components/v3";
-import { useOrganization } from "@app/context";
+import { useOrganization, useOrgPermission } from "@app/context";
+import {
+ OrgPermissionAdminConsoleAction,
+ OrgPermissionSubjects
+} from "@app/context/OrgPermissionContext/types";
import {
getProjectDescription,
getProjectLottieIcon,
@@ -19,7 +25,8 @@ import {
} from "@app/helpers/project";
import { useGetUserProjects } from "@app/hooks/api";
import { useCertManagerInstanceState } from "@app/hooks/api/certManagerInstance";
-import { ProjectType } from "@app/hooks/api/projects/types";
+import { useOrgAdminAccessProject } from "@app/hooks/api/orgAdmin/mutation";
+import { Project, ProjectType } from "@app/hooks/api/projects/types";
const PRODUCT_TYPES: ProjectType[] = [
ProjectType.SecretManager,
@@ -32,8 +39,13 @@ const PRODUCT_TYPES: ProjectType[] = [
export const ProjectCategoryOverview = () => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
+ const { permission } = useOrgPermission();
const { data: projects = [], isPending: isProjectsLoading } = useGetUserProjects();
const { data: certManagerInstance } = useCertManagerInstanceState();
+ const orgAdminAccessProject = useOrgAdminAccessProject();
+
+ const [isJoinAdminOpen, setIsJoinAdminOpen] = useState(false);
+ const [isRequestAccessOpen, setIsRequestAccessOpen] = useState(false);
const projectCountsByType = useMemo(
() =>
@@ -43,15 +55,61 @@ export const ProjectCategoryOverview = () => {
[projects]
);
+ const certManagerActiveProjectId = certManagerInstance?.activeProjectId ?? null;
+ const certManagerActiveProject = useMemo(
+ () =>
+ certManagerActiveProjectId
+ ? certManagerInstance?.projects.find((p) => p.id === certManagerActiveProjectId)
+ : undefined,
+ [certManagerInstance, certManagerActiveProjectId]
+ );
+ const isMemberOfCertManagerProject = useMemo(
+ () =>
+ certManagerActiveProjectId
+ ? projects.some((p) => p.id === certManagerActiveProjectId)
+ : false,
+ [projects, certManagerActiveProjectId]
+ );
+
+ const navigateToCertManager = (projectId: string) => {
+ navigate({
+ to: "/organizations/$orgId/projects/cert-manager/$projectId/overview",
+ params: { orgId: currentOrg?.id ?? "", projectId }
+ });
+ };
+
+ const handleJoinAsAdmin = async () => {
+ if (!certManagerActiveProjectId) return;
+ try {
+ await orgAdminAccessProject.mutateAsync({ projectId: certManagerActiveProjectId });
+ setIsJoinAdminOpen(false);
+ navigateToCertManager(certManagerActiveProjectId);
+ } catch (err) {
+ createNotification({
+ type: "error",
+ text: err instanceof Error ? err.message : "Failed to join the Certificate Manager project."
+ });
+ }
+ };
+
const handleTileClick = (type: ProjectType) => {
const orgId = currentOrg?.id || "";
if (type === ProjectType.CertificateManager) {
- if (certManagerInstance?.activeProjectId) {
- navigate({
- to: "/organizations/$orgId/projects/cert-manager/$projectId/overview",
- params: { orgId, projectId: certManagerInstance.activeProjectId }
- });
+ if (!certManagerActiveProjectId) return;
+ if (isMemberOfCertManagerProject) {
+ navigateToCertManager(certManagerActiveProjectId);
+ return;
+ }
+ if (
+ permission.can(
+ OrgPermissionAdminConsoleAction.AccessAllProjects,
+ OrgPermissionSubjects.AdminConsole
+ )
+ ) {
+ setIsJoinAdminOpen(true);
+ } else {
+ setIsRequestAccessOpen(true);
}
return;
}
@@ -81,48 +139,87 @@ export const ProjectCategoryOverview = () => {
);
}
+ const requestAccessProject: Project | undefined = certManagerActiveProject
+ ? ({
+ id: certManagerActiveProject.id,
+ name: certManagerActiveProject.name
+ } as Project)
+ : undefined;
+
return (
- <div className="grid grid-cols-1 gap-5 lg:grid-cols-2 xl:grid-cols-3">
- {PRODUCT_TYPES.map((type) => {
- const isCertManager = type === ProjectType.CertificateManager;
- const count = projectCountsByType[type] || 0;
- const isDisabled = isCertManager && !certManagerInstance?.activeProjectId;
-
- return (
- <Card
- key={type}
- role="button"
- tabIndex={isDisabled ? -1 : 0}
- aria-disabled={isDisabled}
- onClick={() => !isDisabled && handleTileClick(type)}
- onKeyDown={(e) => {
- if (e.key === "Enter" && !isDisabled) handleTileClick(type);
- }}
- className={`group relative h-auto cursor-pointer overflow-hidden px-7 transition-all duration-100 before:absolute before:inset-y-0 before:left-0 before:w-1.5 before:bg-mineshaft-400 before:transition-colors before:content-[''] hover:bg-card/80 hover:before:bg-primary ${
- isDisabled ? "cursor-not-allowed opacity-40" : ""
- }`}
- >
- <CardHeader>
- <CardTitle className="flex items-start justify-between">
- <div className="rounded-sm border border-mineshaft-500 bg-mineshaft-600 p-1.5 shadow-inner">
- <Lottie className="h-7 w-7 shrink-0" icon={getProjectLottieIcon(type)} />
- </div>
- {!isCertManager && count > 1 && (
- <span className="text-xs font-normal text-accent">{count} projects</span>
- )}
- </CardTitle>
- <CardDescription className="mt-3 text-lg font-semibold text-foreground">
- {getProjectTitle(type)}
- </CardDescription>
- </CardHeader>
- <CardContent>
- <p className="line-clamp-3 text-sm leading-relaxed text-accent">
- {getProjectDescription(type)}
- </p>
- </CardContent>
- </Card>
- );
- })}
- </div>
+ <>
+ <div className="grid grid-cols-1 gap-5 lg:grid-cols-2 xl:grid-cols-3">
+ {PRODUCT_TYPES.map((type) => {
+ const isCertManager = type === ProjectType.CertificateManager;
+ const count = projectCountsByType[type] || 0;
+ const isDisabled = isCertManager && !certManagerInstance?.activeProjectId;
+
+ return (
+ <Card
+ key={type}
+ role="button"
+ tabIndex={isDisabled ? -1 : 0}
+ aria-disabled={isDisabled}
+ onClick={() => !isDisabled && handleTileClick(type)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && !isDisabled) handleTileClick(type);
+ }}
+ className={`group relative h-auto cursor-pointer overflow-hidden px-7 transition-all duration-100 before:absolute before:inset-y-0 before:left-0 before:w-1.5 before:bg-mineshaft-400 before:transition-colors before:content-[''] hover:bg-card/80 hover:before:bg-primary ${
+ isDisabled ? "cursor-not-allowed opacity-40" : ""
+ }`}
+ >
+ <CardHeader>
+ <CardTitle className="flex items-start justify-between">
+ <div className="rounded-sm border border-mineshaft-500 bg-mineshaft-600 p-1.5 shadow-inner">
+ <Lottie className="h-7 w-7 shrink-0" icon={getProjectLottieIcon(type)} />
+ </div>
+ {!isCertManager && count > 1 && (
+ <span className="text-xs font-normal text-accent">{count} projects</span>
+ )}
+ </CardTitle>
+ <CardDescription className="mt-3 text-lg font-semibold text-foreground">
+ {getProjectTitle(type)}
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <p className="line-clamp-3 text-sm leading-relaxed text-accent">
+ {getProjectDescription(type)}
+ </p>
+ </CardContent>
+ </Card>
+ );
+ })}
+ </div>
+
+ <Modal isOpen={isJoinAdminOpen} onOpenChange={setIsJoinAdminOpen}>
+ <ModalContent
+ title="Join Certificate Manager"
+ subTitle="You are not a member of Certificate Manager. Click Continue to join as an admin."
+ >
+ <div className="mt-4 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ onClick={handleJoinAsAdmin}
+ isLoading={orgAdminAccessProject.isPending}
+ >
+ Continue
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </ModalContent>
+ </Modal>
+
+ <RequestProjectAccessModal
+ isOpen={isRequestAccessOpen}
+ onOpenChange={setIsRequestAccessOpen}
+ project={requestAccessProject}
+ subTitle="Requesting access to Certificate Manager. You may include an optional note for admins to review your request."
+ />
+ </>
);
};
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
index 5ef6b0a117..51f4a21197 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
@@ -298,6 +298,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
const name =
u.firstName || u.lastName ? `${u.firstName} ${u.lastName || ""}` : null;
const email = u?.email || inviteEmail;
+ const detailKey = isCertManager ? u.id : membershipId;
return (
<TableRow
@@ -311,7 +312,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
to: `${getProjectBaseURL(currentProject.type)}/members/$membershipId`,
params: {
projectId,
- membershipId
+ membershipId: detailKey
}
});
}
@@ -321,7 +322,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
to: `${getProjectBaseURL(currentProject.type)}/members/$membershipId`,
params: {
projectId,
- membershipId
+ membershipId: detailKey
}
})
}
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
index 54fbac14ae..867c08a52f 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
@@ -40,7 +40,8 @@ const Page = () => {
const { data: groupMembership, isPending } = useGetWorkspaceGroupMembershipDetails(
currentProject.id,
- groupId
+ groupId,
+ currentProject.type
);
const { mutateAsync: deleteMutateAsync } = useDeleteGroupFromWorkspace();
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
index 24be278813..7d61d21561 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
@@ -68,7 +68,7 @@ const Page = () => {
const { currentOrg, isSubOrganization } = useOrganization();
const { data: identityMembershipDetails, isPending: isMembershipDetailsLoading } =
- useGetProjectIdentityMembershipV2(projectId, identityId);
+ useGetProjectIdentityMembershipV2(projectId, identityId, currentProject?.type);
const { mutateAsync: removeIdentityMutateAsync } = useDeleteProjectIdentityMembership();