diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.ts index 0b37422e5a..07185bec2a 100644 --- a/backend/src/ee/services/pam-session/pam-session-service.ts +++ b/backend/src/ee/services/pam-session/pam-session-service.ts @@ -152,6 +152,13 @@ export const pamSessionServiceFactory = ({ OrgPermissionSubjects.Gateway ); + if (session.status === PamSessionStatus.Ended) { + return { + session, + projectId: project.id + }; + } + if (session.status !== PamSessionStatus.Active) { throw new BadRequestError({ message: "Cannot end sessions that are not active" }); } diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx index 8ef588e23a..be3d40001a 100644 --- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx +++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx @@ -5,7 +5,7 @@ import ms from "ms"; import { createNotification } from "@app/components/notifications"; import { Button, FormLabel, Input, Modal, ModalClose, ModalContent } from "@app/components/v2"; -import { TPamAccount } from "@app/hooks/api/pam"; +import { PamResourceType, TPamAccount } from "@app/hooks/api/pam"; type Props = { account?: TPamAccount; @@ -19,7 +19,10 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account }: Props) const isDurationValid = useMemo(() => duration && ms(duration || "1s") > 0, [duration]); const command = useMemo( - () => (account ? `infisical pam access ${account.id} --duration ${duration}` : ""), + () => + account && account.resource.resourceType === PamResourceType.Postgres + ? `infisical pam db access-account ${account.id} --duration ${duration}` + : "", [account, duration] ); diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx index 81a2471dd8..c07e0d1abd 100644 --- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx +++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx @@ -13,7 +13,7 @@ export const PamSessionLogsSection = ({ session }: Props) => {