mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 07:27:43 +00:00
fix: adds account-path and project-id in pam access modal
This commit is contained in:
@@ -10,11 +10,26 @@ import { PamResourceType, TPamAccount } from "@app/hooks/api/pam";
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
account?: TPamAccount;
|
account?: TPamAccount;
|
||||||
|
accountPath?: string;
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
onOpenChange: (isOpen: boolean) => void;
|
onOpenChange: (isOpen: boolean) => void;
|
||||||
|
projectId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PamAccessAccountModal = ({ isOpen, onOpenChange, account }: Props) => {
|
export const PamAccessAccountModal = ({
|
||||||
|
isOpen,
|
||||||
|
onOpenChange,
|
||||||
|
account,
|
||||||
|
projectId,
|
||||||
|
accountPath
|
||||||
|
}: Props) => {
|
||||||
|
let fullAccountPath = account?.name;
|
||||||
|
if (accountPath) {
|
||||||
|
let path = accountPath;
|
||||||
|
if (path.startsWith("/")) path = path.slice(1);
|
||||||
|
fullAccountPath = `${path}/${account?.name}`;
|
||||||
|
}
|
||||||
|
|
||||||
const { protocol, hostname, port } = window.location;
|
const { protocol, hostname, port } = window.location;
|
||||||
const portSuffix = port && port !== "80" && port !== "443" ? `:${port}` : "";
|
const portSuffix = port && port !== "80" && port !== "443" ? `:${port}` : "";
|
||||||
const siteURL = `${protocol}//${hostname}${portSuffix}`;
|
const siteURL = `${protocol}//${hostname}${portSuffix}`;
|
||||||
@@ -68,9 +83,9 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account }: Props)
|
|||||||
switch (account.resource.resourceType) {
|
switch (account.resource.resourceType) {
|
||||||
case PamResourceType.Postgres:
|
case PamResourceType.Postgres:
|
||||||
case PamResourceType.MySQL:
|
case PamResourceType.MySQL:
|
||||||
return `infisical pam db access-account ${account.id} --duration ${cliDuration} --domain ${siteURL}`;
|
return `infisical pam db access-account ${fullAccountPath} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;
|
||||||
case PamResourceType.SSH:
|
case PamResourceType.SSH:
|
||||||
return `infisical pam ssh access-account ${account.id} --duration ${cliDuration} --domain ${siteURL}`;
|
return `infisical pam ssh access-account ${fullAccountPath} --project-id ${projectId} --duration ${cliDuration} --domain ${siteURL}`;
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -466,6 +466,12 @@ export const PamAccountsTable = ({ projectId }: Props) => {
|
|||||||
isOpen={popUp.accessAccount.isOpen}
|
isOpen={popUp.accessAccount.isOpen}
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("accessAccount", isOpen)}
|
onOpenChange={(isOpen) => handlePopUpToggle("accessAccount", isOpen)}
|
||||||
account={popUp.accessAccount.data}
|
account={popUp.accessAccount.data}
|
||||||
|
accountPath={
|
||||||
|
popUp.accessAccount.data?.folderId
|
||||||
|
? folderPaths[popUp.accessAccount.data.folderId]
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
projectId={projectId}
|
||||||
/>
|
/>
|
||||||
<PamDeleteAccountModal
|
<PamDeleteAccountModal
|
||||||
isOpen={popUp.deleteAccount.isOpen}
|
isOpen={popUp.deleteAccount.isOpen}
|
||||||
|
|||||||
Reference in New Issue
Block a user