Skip to content

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

display account type

x0322052c846419636b
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
index de66646834..17d181d21e 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
@@ -13,9 +13,9 @@ import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
import {
PamResourceType,
- TActiveDirectoryCredentials,
+ TActiveDirectoryAccount,
TPamAccount,
- TWindowsCredentials
+ TWindowsAccount
} from "@app/hooks/api/pam";
import { TAwsIamCredentials } from "@app/hooks/api/pam/types/aws-iam-resource";
import { TBaseSqlCredentials } from "@app/hooks/api/pam/types/shared/sql-resource";
@@ -77,16 +77,28 @@ const AwsIamCredentialsContent = ({ credentials }: { credentials: TAwsIamCredent
</>
);
-const WindowsCredentialsContent = ({ credentials }: { credentials: TWindowsCredentials }) => {
- return <CopyableField label="Username" value={credentials.username} />;
+const WindowsCredentialsContent = ({ account }: { account: TWindowsAccount }) => {
+ return (
+ <>
+ <Detail>
+ <DetailLabel>Account Type</DetailLabel>
+ <DetailValue className="capitalize">{account.metadata.accountType}</DetailValue>
+ </Detail>
+ <CopyableField label="Username" value={account.credentials.username} />
+ </>
+ );
};
-const ActiveDirectoryCredentialsContent = ({
- credentials
-}: {
- credentials: TActiveDirectoryCredentials;
-}) => {
- return <CopyableField label="Username" value={credentials.username} />;
+const ActiveDirectoryCredentialsContent = ({ account }: { account: TActiveDirectoryAccount }) => {
+ return (
+ <>
+ <Detail>
+ <DetailLabel>Account Type</DetailLabel>
+ <DetailValue className="capitalize">{account.metadata.accountType}</DetailValue>
+ </Detail>
+ <CopyableField label="Username" value={account.credentials.username} />
+ </>
+ );
};
const CredentialsContent = ({ account }: { account: TPamAccount }) => {
@@ -102,13 +114,9 @@ const CredentialsContent = ({ account }: { account: TPamAccount }) => {
case PamResourceType.AwsIam:
return <AwsIamCredentialsContent credentials={account.credentials as TAwsIamCredentials} />;
case PamResourceType.Windows:
- return <WindowsCredentialsContent credentials={account.credentials as TWindowsCredentials} />;
+ return <WindowsCredentialsContent account={account as TWindowsAccount} />;
case PamResourceType.ActiveDirectory:
- return (
- <ActiveDirectoryCredentialsContent
- credentials={account.credentials as TActiveDirectoryCredentials}
- />
- );
+ return <ActiveDirectoryCredentialsContent account={account as TActiveDirectoryAccount} />;
default:
return null;
}
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
index 754d73d129..e5536c8d59 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
@@ -39,7 +39,14 @@ import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
import { usePopUp, useToggle } from "@app/hooks";
import { ApprovalPolicyType, useCheckPolicyMatch } from "@app/hooks/api/approvalPolicies";
-import { PamResourceType, TPamAccount, TPamResource, useListPamAccounts } from "@app/hooks/api/pam";
+import {
+ PamResourceType,
+ TActiveDirectoryAccount,
+ TPamAccount,
+ TPamResource,
+ TWindowsAccount,
+ useListPamAccounts
+} from "@app/hooks/api/pam";
import { PamAccessAccountModal } from "../../PamAccountsPage/components/PamAccessAccountModal";
import { PamAddAccountModal } from "../../PamAccountsPage/components/PamAddAccountModal";
@@ -53,6 +60,19 @@ type Props = {
resource: TPamResource;
};
+const hasAccountType = (resourceType: PamResourceType) =>
+ resourceType === PamResourceType.Windows || resourceType === PamResourceType.ActiveDirectory;
+
+const getAccountType = (account: TPamAccount): string | undefined => {
+ if (account.resource.resourceType === PamResourceType.Windows) {
+ return (account as TWindowsAccount).metadata?.accountType;
+ }
+ if (account.resource.resourceType === PamResourceType.ActiveDirectory) {
+ return (account as TActiveDirectoryAccount).metadata?.accountType;
+ }
+ return undefined;
+};
+
export const PamResourceAccountsSection = ({ resource }: Props) => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
@@ -165,20 +185,24 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
<UnstableTableHeader>
<UnstableTableRow>
<UnstableTableHead>Account Name</UnstableTableHead>
+ {hasAccountType(resource.resourceType) && <UnstableTableHead>Type</UnstableTableHead>}
<UnstableTableHead className="w-5" />
</UnstableTableRow>
</UnstableTableHeader>
<UnstableTableBody>
{isPending && (
<UnstableTableRow>
- <UnstableTableCell colSpan={2} className="text-center text-muted">
+ <UnstableTableCell
+ colSpan={hasAccountType(resource.resourceType) ? 3 : 2}
+ className="text-center text-muted"
+ >
Loading accounts...
</UnstableTableCell>
</UnstableTableRow>
)}
{!isPending && accounts.length === 0 && (
<UnstableTableRow>
- <UnstableTableCell colSpan={2}>
+ <UnstableTableCell colSpan={hasAccountType(resource.resourceType) ? 3 : 2}>
<UnstableEmpty className="border-0 bg-transparent py-8 shadow-none">
<UnstableEmptyHeader>
<UnstableEmptyTitle>No accounts found</UnstableEmptyTitle>
@@ -237,6 +261,11 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
)}
</div>
</UnstableTableCell>
+ {hasAccountType(resource.resourceType) && (
+ <UnstableTableCell>
+ <span className="capitalize">{getAccountType(account) ?? "-"}</span>
+ </UnstableTableCell>
+ )}
<UnstableTableCell>
<div className="flex items-center gap-2">
{/* Temporarily disable accessing Windows Server accounts */}