Skip to content

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

add badge for when the passwords are not configured

x032205da9e12084fc0
diff --git a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts
index d78128734d..d07e19bd7b 100644
--- a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts
+++ b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts
@@ -22,16 +22,22 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
import { TokenType } from "@app/services/auth-token/auth-token-types";
-const SanitizedAccountSchema = z.discriminatedUnion("resourceType", [
- SanitizedKubernetesAccountWithResourceSchema,
- SanitizedSSHAccountWithResourceSchema,
- SanitizedPostgresAccountWithResourceSchema,
- SanitizedMySQLAccountWithResourceSchema,
- SanitizedRedisAccountWithResourceSchema,
- SanitizedAwsIamAccountWithResourceSchema,
- SanitizedWindowsAccountWithResourceSchema,
- SanitizedActiveDirectoryAccountWithResourceSchema
-]);
+const SanitizedAccountSchema = z
+ .discriminatedUnion("resourceType", [
+ SanitizedKubernetesAccountWithResourceSchema,
+ SanitizedSSHAccountWithResourceSchema,
+ SanitizedPostgresAccountWithResourceSchema,
+ SanitizedMySQLAccountWithResourceSchema,
+ SanitizedRedisAccountWithResourceSchema,
+ SanitizedAwsIamAccountWithResourceSchema,
+ SanitizedWindowsAccountWithResourceSchema,
+ SanitizedActiveDirectoryAccountWithResourceSchema
+ ])
+ .and(
+ z.object({
+ credentialsConfigured: z.boolean()
+ })
+ );
const ListPamAccountsResponseSchema = z.object({
accounts: SanitizedAccountSchema.array(),
diff --git a/backend/src/ee/services/pam-account/pam-account-fns.ts b/backend/src/ee/services/pam-account/pam-account-fns.ts
index 71ef0fd7bd..008035dd37 100644
--- a/backend/src/ee/services/pam-account/pam-account-fns.ts
+++ b/backend/src/ee/services/pam-account/pam-account-fns.ts
@@ -2,6 +2,7 @@ import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { KmsDataKey } from "@app/services/kms/kms-types";
import { TPamAccountCredentials } from "../pam-resource/pam-resource-types";
+import { SSHAuthMethod } from "../pam-resource/ssh/ssh-resource-enums";
export const encryptAccountCredentials = async ({
projectId,
@@ -66,6 +67,15 @@ export const decryptAccountMessage = async ({
return decryptedPlainTextBlob.toString();
};
+const hasConfiguredCredentials = (credentials: TPamAccountCredentials): boolean => {
+ if ("password" in credentials && credentials.password) return true;
+ if ("privateKey" in credentials && credentials.privateKey) return true;
+ if ("serviceAccountToken" in credentials && credentials.serviceAccountToken) return true;
+ if ("targetRoleArn" in credentials && credentials.targetRoleArn) return true;
+ if ("authMethod" in credentials && credentials.authMethod === SSHAuthMethod.Certificate) return true;
+ return false;
+};
+
export const decryptAccount = async <
T extends { encryptedCredentials: Buffer; encryptedLastRotationMessage?: Buffer | null }
>(
@@ -75,18 +85,22 @@ export const decryptAccount = async <
): Promise<
Omit<T, "encryptedCredentials" | "encryptedLastRotationMessage"> & {
credentials: TPamAccountCredentials;
+ credentialsConfigured: boolean;
lastRotationMessage: string | null;
}
> => {
const { encryptedCredentials, encryptedLastRotationMessage, ...rest } = account;
+ const credentials = await decryptAccountCredentials({
+ encryptedCredentials,
+ projectId,
+ kmsService
+ });
+
return {
...rest,
- credentials: await decryptAccountCredentials({
- encryptedCredentials,
- projectId,
- kmsService
- }),
+ credentials,
+ credentialsConfigured: hasConfiguredCredentials(credentials),
lastRotationMessage: encryptedLastRotationMessage
? await decryptAccountMessage({
encryptedMessage: encryptedLastRotationMessage,
diff --git a/frontend/src/hooks/api/pam/types/base-account.ts b/frontend/src/hooks/api/pam/types/base-account.ts
index b58ea2e0cc..beec513bbb 100644
--- a/frontend/src/hooks/api/pam/types/base-account.ts
+++ b/frontend/src/hooks/api/pam/types/base-account.ts
@@ -13,6 +13,7 @@ export interface TBasePamAccount {
};
name: string;
description?: string | null;
+ credentialsConfigured: boolean;
rotationEnabled: boolean;
rotationIntervalSeconds?: number;
requireMfa?: boolean | null;
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountViewToggle.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountViewToggle.tsx
deleted file mode 100644
index 4448845cf2..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountViewToggle.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { faBorderAll, faList } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { IconButton } from "@app/components/v2";
-import { PamAccountView } from "@app/hooks/api/pam";
-
-type Props = {
- value: PamAccountView;
- onChange: (value: PamAccountView) => void;
-};
-
-export const AccountViewToggle = ({ value, onChange }: Props) => {
- return (
- <div className="flex gap-0.5 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-1">
- <IconButton
- variant="outline_bg"
- onClick={() => {
- onChange(PamAccountView.Flat);
- }}
- ariaLabel="grid"
- size="xs"
- className={`${
- value === PamAccountView.Flat ? "bg-mineshaft-500" : "bg-transparent"
- } min-w-[2.4rem] rounded border-none hover:bg-mineshaft-600`}
- >
- <FontAwesomeIcon icon={faBorderAll} />
- </IconButton>
- <IconButton
- variant="outline_bg"
- onClick={() => {
- onChange(PamAccountView.Nested);
- }}
- ariaLabel="list"
- size="xs"
- className={`${
- value === PamAccountView.Nested ? "bg-mineshaft-500" : "bg-transparent"
- } min-w-[2.4rem] rounded border-none hover:bg-mineshaft-600`}
- >
- <FontAwesomeIcon icon={faList} />
- </IconButton>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountCard.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountCard.tsx
deleted file mode 100644
index d4211cf99a..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountCard.tsx
+++ /dev/null
@@ -1,129 +0,0 @@
-import { useCallback } from "react";
-import { faCheck, faCopy, faEdit, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { EllipsisIcon, LogInIcon, PackageOpenIcon } from "lucide-react";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger
-} from "@app/components/v2";
-import { Badge, Button, UnstableIconButton } from "@app/components/v3";
-import {
- ProjectPermissionPamAccountActions,
- ProjectPermissionSub
-} from "@app/context/ProjectPermissionContext/types";
-import { useToggle } from "@app/hooks";
-import { PAM_RESOURCE_TYPE_MAP, TPamAccount } from "@app/hooks/api/pam";
-
-type Props = {
- account: TPamAccount;
- onAccess: (resource: TPamAccount) => void;
- onUpdate: (resource: TPamAccount) => void;
- onDelete: (resource: TPamAccount) => void;
-};
-
-export const PamAccountCard = ({ account, onAccess, onUpdate, onDelete }: Props) => {
- const { id, name, description, resource } = account;
-
- const { image, name: resourceTypeName } = PAM_RESOURCE_TYPE_MAP[account.resource.resourceType];
-
- const [isIdCopied, setIsIdCopied] = useToggle(false);
-
- const handleCopyId = useCallback(
- (idToCopy: string) => {
- setIsIdCopied.on();
- navigator.clipboard.writeText(idToCopy);
-
- createNotification({
- text: "Account ID copied to clipboard",
- type: "info"
- });
-
- setTimeout(() => setIsIdCopied.off(), 2000);
- },
- [setIsIdCopied]
- );
-
- return (
- <div
- key={account.id}
- className="flex flex-col overflow-clip rounded-sm border border-mineshaft-600 bg-mineshaft-800 p-4 text-start transition-transform duration-100"
- >
- <div className="flex items-center gap-3.5">
- <img
- alt={resourceTypeName}
- src={`/images/integrations/${image}`}
- className="size-10 object-contain"
- />
- <div className="min-w-0 flex-1">
- <div className="flex items-center justify-between gap-2">
- <p className="truncate text-lg font-medium text-mineshaft-100">{name}</p>
- <div className="flex items-center gap-2">
- <Button onClick={() => onAccess(account)} size="xs" variant="outline">
- <LogInIcon />
- Connect
- </Button>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <UnstableIconButton size="xs" variant="ghost">
- <EllipsisIcon />
- </UnstableIconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <DropdownMenuItem
- icon={<FontAwesomeIcon icon={isIdCopied ? faCheck : faCopy} />}
- onClick={(e) => {
- e.stopPropagation();
- handleCopyId(id);
- }}
- >
- Copy Account ID
- </DropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faEdit} />}
- onClick={() => onUpdate(account)}
- >
- Edit Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Delete}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faTrash} />}
- onClick={() => onDelete(account)}
- >
- Delete Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
-
- <p className="truncate text-xs leading-4 text-mineshaft-300">{resourceTypeName}</p>
- </div>
- </div>
- <Badge variant="neutral" className="mt-3.5">
- <PackageOpenIcon />
- {resource.name}
- </Badge>
- <p className="mt-2 truncate text-sm text-mineshaft-400">{description || "No description"}</p>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountRow.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountRow.tsx
deleted file mode 100644
index 8939543c2c..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountRow.tsx
+++ /dev/null
@@ -1,180 +0,0 @@
-import { useCallback } from "react";
-import {
- faCheck,
- faCopy,
- faEdit,
- faEllipsisV,
- faRightToBracket,
- faRotate,
- faTrash
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { formatDistance } from "date-fns";
-import { PackageOpenIcon } from "lucide-react";
-import { twMerge } from "tailwind-merge";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- IconButton,
- Td,
- Tooltip,
- Tr
-} from "@app/components/v2";
-import { HighlightText } from "@app/components/v2/HighlightText";
-import { Badge } from "@app/components/v3";
-import { ProjectPermissionSub } from "@app/context";
-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import { useToggle } from "@app/hooks";
-import { PAM_RESOURCE_TYPE_MAP, TPamAccount } from "@app/hooks/api/pam";
-
-type Props = {
- account: TPamAccount;
- onAccess: (resource: TPamAccount) => void;
- onUpdate: (resource: TPamAccount) => void;
- onDelete: (resource: TPamAccount) => void;
- search: string;
- isAccessLoading?: boolean;
-};
-
-export const PamAccountRow = ({
- account,
- search,
- onAccess,
- onUpdate,
- onDelete,
- isAccessLoading
-}: Props) => {
- const { id, name } = account;
-
- const { image, name: resourceTypeName } = PAM_RESOURCE_TYPE_MAP[account.resource.resourceType];
-
- const [isIdCopied, setIsIdCopied] = useToggle(false);
-
- const handleCopyId = useCallback(
- (idToCopy: string) => {
- setIsIdCopied.on();
- navigator.clipboard.writeText(idToCopy);
-
- createNotification({
- text: "Account ID copied to clipboard",
- type: "info"
- });
-
- setTimeout(() => setIsIdCopied.off(), 2000);
- },
- [setIsIdCopied]
- );
-
- return (
- <Tr className={twMerge("group h-10")} key={`account-${id}`}>
- <Td>
- <div className="flex items-center gap-4">
- <div className="relative">
- <img alt={resourceTypeName} src={`/images/integrations/${image}`} className="size-5" />
- </div>
- <div className="flex items-center gap-3">
- <span>
- <HighlightText text={name} highlight={search} />
- </span>
- <Badge variant="neutral">
- <PackageOpenIcon />
- <span>
- <HighlightText text={account.resource.name} highlight={search} />
- </span>
- </Badge>
- {"lastRotatedAt" in account && account.lastRotatedAt && (
- <Tooltip
- className="max-w-sm text-center"
- isDisabled={!account.lastRotationMessage}
- content={account.lastRotationMessage}
- >
- <Badge variant={account.rotationStatus === "failed" ? "danger" : "success"}>
- <FontAwesomeIcon icon={faRotate} />
- <span>Rotated {formatDistance(new Date(), account.lastRotatedAt)} ago</span>
- </Badge>
- </Tooltip>
- )}
- </div>
- </div>
- </Td>
- <Td>
- <div className="flex items-center gap-2">
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Access}
- a={ProjectPermissionSub.PamAccounts}
- >
- <Button
- colorSchema="secondary"
- leftIcon={<FontAwesomeIcon icon={faRightToBracket} />}
- onClick={() => onAccess(account)}
- size="xs"
- isLoading={isAccessLoading}
- isDisabled={isAccessLoading}
- >
- Access
- </Button>
- </ProjectPermissionCan>
- <Tooltip className="max-w-sm text-center" content="Options">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Options"
- colorSchema="secondary"
- className="w-6"
- variant="plain"
- >
- <FontAwesomeIcon icon={faEllipsisV} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <DropdownMenuItem
- icon={<FontAwesomeIcon icon={isIdCopied ? faCheck : faCopy} />}
- onClick={(e) => {
- e.stopPropagation();
- handleCopyId(id);
- }}
- >
- Copy Account ID
- </DropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faEdit} />}
- onClick={() => onUpdate(account)}
- >
- Edit Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Delete}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faTrash} />}
- onClick={() => onDelete(account)}
- >
- Delete Account
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </Tooltip>
- </div>
- </Td>
- </Tr>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAddFolderModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAddFolderModal.tsx
deleted file mode 100644
index d81bd743c8..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAddFolderModal.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { createNotification } from "@app/components/notifications";
-import { Modal, ModalContent } from "@app/components/v2";
-import { TPamFolder, useCreatePamFolder } from "@app/hooks/api/pam";
-
-import { PamFolderForm } from "./PamFolderForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- projectId: string;
- currentFolderId: string | null;
-};
-
-export const PamAddFolderModal = ({ isOpen, onOpenChange, projectId, currentFolderId }: Props) => {
- const createPamFolder = useCreatePamFolder();
-
- const onSubmit = async (formData: Pick<TPamFolder, "name" | "description">) => {
- await createPamFolder.mutateAsync({
- ...formData,
- parentId: currentFolderId,
- projectId
- });
- createNotification({
- text: "Successfully created folder",
- type: "success"
- });
- onOpenChange(false);
- };
-
- return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent className="max-w-2xl" title="Create Folder">
- <PamFolderForm onSubmit={onSubmit} />
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteFolderModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteFolderModal.tsx
deleted file mode 100644
index d901d0ba08..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteFolderModal.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
-import { TPamFolder, useDeletePamFolder } from "@app/hooks/api/pam";
-
-type Props = {
- folder?: TPamFolder;
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
-};
-
-export const PamDeleteFolderModal = ({ isOpen, onOpenChange, folder }: Props) => {
- const deletePamFolder = useDeletePamFolder();
-
- if (!folder) return null;
-
- const { id: folderId, name } = folder;
-
- const handleDelete = async () => {
- await deletePamFolder.mutateAsync({
- folderId
- });
-
- createNotification({
- text: "Successfully deleted folder",
- type: "success"
- });
-
- onOpenChange(false);
- };
-
- return (
- <DeleteActionModal
- isOpen={isOpen}
- onChange={onOpenChange}
- title={`Are you sure you want to delete ${name}?`}
- deleteKey={name}
- onDeleteApproved={handleDelete}
- />
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamFolderForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamFolderForm.tsx
deleted file mode 100644
index dee216a526..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamFolderForm.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import { Controller, FormProvider, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { Button, FormControl, Input, ModalClose, TextArea } from "@app/components/v2";
-import { TPamFolder } from "@app/hooks/api/pam";
-import { slugSchema } from "@app/lib/schemas";
-
-type Props = {
- folder?: TPamFolder;
- onSubmit: (formData: FormData) => Promise<void>;
-};
-
-const formSchema = z.object({
- name: slugSchema({ min: 1, max: 64, field: "Name" }),
- description: z.string().max(512).optional()
-});
-
-type FormData = z.infer<typeof formSchema>;
-
-export const PamFolderForm = ({ folder, onSubmit }: Props) => {
- const isUpdate = Boolean(folder);
-
- const form = useForm<FormData>({
- resolver: zodResolver(formSchema),
- defaultValues: folder
- ? {
- name: folder.name,
- description: folder.description || ""
- }
- : undefined
- });
-
- const {
- control,
- handleSubmit,
- formState: { isSubmitting, isDirty }
- } = form;
-
- return (
- <FormProvider {...form}>
- <form
- onSubmit={(e) => {
- handleSubmit(onSubmit)(e);
- }}
- >
- <Controller
- name="name"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- helperText="Name must be slug-friendly"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Name"
- >
- <Input autoFocus placeholder="my-folder" {...field} />
- </FormControl>
- )}
- />
- <Controller
- name="description"
- control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Description"
- isOptional
- >
- <TextArea {...field} />
- </FormControl>
- )}
- />
- <div className="mt-6 flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- colorSchema="secondary"
- isLoading={isSubmitting}
- isDisabled={isSubmitting || !isDirty}
- >
- {isUpdate ? "Update Folder" : "Create Folder"}
- </Button>
- <ModalClose asChild>
- <Button colorSchema="secondary" variant="plain">
- Cancel
- </Button>
- </ModalClose>
- </div>
- </form>
- </FormProvider>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamFolderRow.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamFolderRow.tsx
deleted file mode 100644
index 376210066c..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamFolderRow.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import { faEdit, faEllipsisV, faFolder, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- IconButton,
- Td,
- Tooltip,
- Tr
-} from "@app/components/v2";
-import { HighlightText } from "@app/components/v2/HighlightText";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { TPamFolder } from "@app/hooks/api/pam";
-
-type Props = {
- folder: TPamFolder;
- onUpdate: (folder: TPamFolder) => void;
- onDelete: (folder: TPamFolder) => void;
- onClick: () => void;
- search: string;
-};
-
-export const PamFolderRow = ({ folder, onClick, onDelete, onUpdate, search }: Props) => {
- return (
- <Tr
- className="group h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
- onClick={onClick}
- >
- <Td>
- <div className="flex items-center gap-4">
- <div className="flex w-5 justify-center">
- <FontAwesomeIcon icon={faFolder} className="size-4 text-yellow-700" />
- </div>
- <span>
- <HighlightText text={folder.name} highlight={search} />
- </span>
- </div>
- </Td>
- <Td>
- <div className="flex h-[22px] justify-end">
- <Tooltip className="max-w-sm text-center" content="Options">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Options"
- colorSchema="secondary"
- className="hidden w-6 group-hover:flex data-[state=open]:flex!"
- variant="plain"
- >
- <FontAwesomeIcon icon={faEllipsisV} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.PamFolders}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faEdit} />}
- onClick={(e) => {
- e.stopPropagation();
- onUpdate(folder);
- }}
- >
- Edit Folder
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.PamFolders}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faTrash} />}
- onClick={(e) => {
- e.stopPropagation();
- onDelete(folder);
- }}
- >
- Delete Folder
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </Tooltip>
- </div>
- </Td>
- </Tr>
- );
-};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamUpdateFolderModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamUpdateFolderModal.tsx
deleted file mode 100644
index 4162ce25fc..0000000000
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamUpdateFolderModal.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { createNotification } from "@app/components/notifications";
-import { Modal, ModalContent } from "@app/components/v2";
-import { TPamFolder, useUpdatePamFolder } from "@app/hooks/api/pam";
-
-import { PamFolderForm } from "./PamFolderForm";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- folder?: TPamFolder;
-};
-
-export const PamUpdateFolderModal = ({ isOpen, onOpenChange, folder }: Props) => {
- const updatePamFolder = useUpdatePamFolder();
-
- if (!folder) return null;
-
- const onSubmit = async (formData: Pick<TPamFolder, "name" | "description">) => {
- await updatePamFolder.mutateAsync({
- ...formData,
- folderId: folder.id
- });
- createNotification({
- text: "Successfully updated folder",
- type: "success"
- });
- onOpenChange(false);
- };
-
- return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent className="max-w-2xl" title="Edit Account" subTitle="Update account details.">
- <PamFolderForm onSubmit={onSubmit} folder={folder} />
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
index 9a3f63f072..fb3141c8f3 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
@@ -5,6 +5,7 @@ import {
CheckIcon,
CopyIcon,
EllipsisVerticalIcon,
+ KeyRoundIcon,
LogInIcon,
PencilIcon,
PlusIcon,
@@ -228,34 +229,40 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
onClick={() => handleAccountClick(account)}
>
<UnstableTableCell>
- <div className="flex flex-col">
- <div className="flex items-center gap-3">
+ <div className="flex items-center gap-3">
+ <div className="flex flex-col">
<span className="font-medium">{account.name}</span>
- {lastRotatedAt && (
- <Tooltip>
- <TooltipTrigger asChild>
- <Badge
- variant={rotationStatus === "failed" ? "danger" : "success"}
- className="text-xs"
- >
- <RefreshCwIcon className="size-3" />
- <span>
- Rotated {formatDistance(new Date(), new Date(lastRotatedAt))} ago
- </span>
- </Badge>
- </TooltipTrigger>
- {lastRotationMessage && (
- <TooltipContent className="max-w-sm text-center">
- {lastRotationMessage}
- </TooltipContent>
- )}
- </Tooltip>
+ {account.description && (
+ <span className="line-clamp-1 text-xs text-muted">
+ {account.description}
+ </span>
)}
</div>
- {account.description && (
- <span className="line-clamp-1 text-xs text-muted">
- {account.description}
- </span>
+ {!account.credentialsConfigured && (
+ <Badge variant="warning" className="text-xs">
+ <KeyRoundIcon className="size-3" />
+ <span>No password</span>
+ </Badge>
+ )}
+ {lastRotatedAt && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Badge
+ variant={rotationStatus === "failed" ? "danger" : "success"}
+ className="text-xs"
+ >
+ <RefreshCwIcon className="size-3" />
+ <span>
+ Rotated {formatDistance(new Date(), new Date(lastRotatedAt))} ago
+ </span>
+ </Badge>
+ </TooltipTrigger>
+ {lastRotationMessage && (
+ <TooltipContent className="max-w-sm text-center">
+ {lastRotationMessage}
+ </TooltipContent>
+ )}
+ </Tooltip>
)}
</div>
</UnstableTableCell>