Skip to content

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

feat(pam): surface AD-account access from Windows resource page

bernie-g3516b75d74a3
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
index 24e1011a5d..609274527f 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
@@ -274,6 +274,14 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
if (account.resource?.resourceType === PamResourceType.AwsIam) {
handlePopUpOpen("awsIamReason", { account });
+ } else if (account.domainId) {
+ // Domain account being accessed from a resource page — the resource is
+ // implicitly the one we're viewing. Pass it through so the access modal
+ // can build the CLI command without going through PamSelectResourceModal.
+ handlePopUpOpen("accessAccount", {
+ account,
+ resource: { id: resource.id, name: resource.name, resourceType: resource.resourceType, projectId: resource.projectId }
+ });
} else {
handlePopUpOpen("accessAccount", { account });
}
@@ -528,25 +536,22 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
</TableCell>
<TableCell>
<div className="flex items-center gap-2">
- {/* AD-joined accounts (account.domainId) still disabled; AD/RDP is a later phase. */}
- {!account.domainId && (
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Access}
- a={ProjectPermissionSub.PamAccounts}
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Access}
+ a={ProjectPermissionSub.PamAccounts}
+ >
+ <Button
+ variant="ghost"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ accessAccount(account);
+ }}
>
- <Button
- variant="ghost"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- accessAccount(account);
- }}
- >
- <LogInIcon />
- Connect
- </Button>
- </ProjectPermissionCan>
- )}
+ <LogInIcon />
+ Connect
+ </Button>
+ </ProjectPermissionCan>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton variant="ghost" size="xs">
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDetailsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDetailsSection.tsx
index 8424f3a799..674fcf7b50 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDetailsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceDetailsSection.tsx
@@ -1,10 +1,12 @@
+import { Link, useParams } from "@tanstack/react-router";
import { format } from "date-fns";
import { PencilIcon } from "lucide-react";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Detail, DetailGroup, DetailLabel, DetailValue, IconButton } from "@app/components/v3";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
import { TPamResource } from "@app/hooks/api/pam";
+import { PamDomainType, useGetPamDomainById } from "@app/hooks/api/pamDomain";
type Props = {
resource: TPamResource;
@@ -12,6 +14,16 @@ type Props = {
};
export const PamResourceDetailsSection = ({ resource, onEdit }: Props) => {
+ const { currentOrg } = useOrganization();
+ const params = useParams({ strict: false }) as { projectId?: string };
+ const { projectId } = params;
+
+ const { data: domain } = useGetPamDomainById(
+ PamDomainType.ActiveDirectory,
+ resource.domainId || undefined,
+ { enabled: !!resource.domainId }
+ );
+
return (
<div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
<div className="flex items-center justify-between border-b border-border pb-2">
@@ -36,6 +48,25 @@ export const PamResourceDetailsSection = ({ resource, onEdit }: Props) => {
<DetailLabel>Created</DetailLabel>
<DetailValue>{format(new Date(resource.createdAt), "MM/dd/yyyy, hh:mm a")}</DetailValue>
</Detail>
+ {resource.domainId && domain && (
+ <Detail>
+ <DetailLabel>Joined domain</DetailLabel>
+ <DetailValue>
+ <Link
+ to="/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId"
+ params={{
+ orgId: currentOrg.id,
+ projectId: projectId!,
+ domainType: domain.domainType,
+ domainId: domain.id
+ }}
+ className="text-primary hover:underline"
+ >
+ {domain.name}
+ </Link>
+ </DetailValue>
+ </Detail>
+ )}
</DetailGroup>
</div>
);