Skip to content

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

feat(frontend): add descriptions to project permission objects and update related components to v3

Victor Santos9d5ddef44f8b
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
index e54eaf19d4..b0affcafb4 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
@@ -171,6 +171,7 @@ export const ProjectTemplateEditRoleForm = ({
subject={subject}
actions={PROJECT_PERMISSION_OBJECT[subject].actions}
title={PROJECT_PERMISSION_OBJECT[subject].title}
+ description={PROJECT_PERMISSION_OBJECT[subject].description}
key={`project-permission-${subject}`}
isDisabled={isDisabled}
>
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
index 9aa864b593..e0a1b73794 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
@@ -333,6 +333,7 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
subject={permissionSubject}
actions={PROJECT_PERMISSION_OBJECT[permissionSubject].actions}
title={PROJECT_PERMISSION_OBJECT[permissionSubject].title}
+ description={PROJECT_PERMISSION_OBJECT[permissionSubject].description}
key={`project-permission-${permissionSubject}`}
isDisabled={isDisabled}
>
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
index 7185f5a2f0..9b834baa62 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
@@ -329,6 +329,7 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
subject={permissionSubject}
actions={PROJECT_PERMISSION_OBJECT[permissionSubject].actions}
title={PROJECT_PERMISSION_OBJECT[permissionSubject].title}
+ description={PROJECT_PERMISSION_OBJECT[permissionSubject].description}
key={`project-permission-${permissionSubject}`}
isDisabled={isDisabled}
>
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
index 1ac04dae09..97e9916b3b 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
@@ -1,14 +1,17 @@
-import { faAngleDown, faLayerGroup, faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { ChevronDownIcon, LayersIcon, PlusIcon, UploadIcon } from "lucide-react";
import {
Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
- IconButton,
- Tooltip
-} from "@app/components/v2";
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ UnstableButtonGroup,
+ UnstableDropdownMenu,
+ UnstableDropdownMenuContent,
+ UnstableDropdownMenuItem,
+ UnstableDropdownMenuTrigger,
+ UnstableIconButton
+} from "@app/components/v3";
import { useOrgPermission } from "@app/context";
import { OrgMembershipRole } from "@app/helpers/roles";
import { usePopUp } from "@app/hooks";
@@ -40,75 +43,58 @@ export const AddPoliciesButton = ({ isDisabled, projectType, projectId }: Props)
return (
<div>
- <Button
- className="h-10 rounded-r-none"
- variant="outline_bg"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- isDisabled={isDisabled}
- onClick={() => handlePopUpToggle("addPolicy")}
- >
- Add Policies
- </Button>
- <DropdownMenu
- open={popUp.addPolicyOptions.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("addPolicyOptions", isOpen)}
- >
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Open policy template options"
- variant="outline_bg"
- className="rounded-l-none bg-mineshaft-600 p-3"
- >
- <FontAwesomeIcon icon={faAngleDown} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <div className="flex flex-col space-y-1 p-1.5">
- <Button
- leftIcon={<FontAwesomeIcon icon={faLayerGroup} className="pr-2" />}
+ <UnstableButtonGroup>
+ <Button
+ className="rounded-r-none"
+ isDisabled={isDisabled}
+ variant="outline"
+ onClick={() => handlePopUpToggle("addPolicy")}
+ >
+ <PlusIcon />
+ Add Policies
+ </Button>
+ <UnstableDropdownMenu
+ open={popUp.addPolicyOptions.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("addPolicyOptions", isOpen)}
+ >
+ <UnstableDropdownMenuTrigger asChild>
+ <UnstableIconButton variant="outline">
+ <ChevronDownIcon />
+ </UnstableIconButton>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent align="end">
+ <UnstableDropdownMenuItem
onClick={() => {
handlePopUpOpen("applyTemplate");
handlePopUpClose("addPolicyOptions");
}}
isDisabled={isDisabled}
- variant="outline_bg"
- className="h-10 text-left"
- isFullWidth
>
+ <LayersIcon />
Add From Template
- </Button>
+ </UnstableDropdownMenuItem>
{hasVaultConnection && (
- <Tooltip
- content={
- !isOrgAdmin
- ? "Only organization admins can import policies from HashiCorp Vault"
- : undefined
- }
- >
- <Button
- leftIcon={
- <img
- src="/images/integrations/Vault.png"
- alt="HashiCorp Vault"
- className="h-4 w-4"
- />
- }
- onClick={() => {
- handlePopUpOpen("importFromVault");
- handlePopUpClose("addPolicyOptions");
- }}
- isDisabled={isVaultImportDisabled}
- variant="outline_bg"
- className="h-10 text-left"
- isFullWidth
- >
- Add from HashiCorp Vault
- </Button>
+ <Tooltip open={!isOrgAdmin ? undefined : false}>
+ <TooltipTrigger className="block w-full">
+ <UnstableDropdownMenuItem
+ onClick={() => {
+ handlePopUpOpen("importFromVault");
+ handlePopUpClose("addPolicyOptions");
+ }}
+ isDisabled={isVaultImportDisabled}
+ >
+ <UploadIcon />
+ Add from HashiCorp Vault
+ </UnstableDropdownMenuItem>
+ </TooltipTrigger>
+ <TooltipContent side="left">
+ Only organization admins can import policies from HashiCorp Vault
+ </TooltipContent>
</Tooltip>
)}
- </div>
- </DropdownMenuContent>
- </DropdownMenu>
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </UnstableButtonGroup>
<PolicySelectionModal
projectId={projectId}
type={projectType}
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ConditionsFields.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ConditionsFields.tsx
index 80fc46e7f8..d9ef3e9b19 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ConditionsFields.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ConditionsFields.tsx
@@ -1,16 +1,22 @@
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
-import { faInfoCircle, faPlus, faTrash, faWarning } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon, PlusIcon, TrashIcon, TriangleAlertIcon } from "lucide-react";
import {
Button,
- FormControl,
- IconButton,
- Input,
+ Field,
+ FieldContent,
+ FieldError,
Select,
+ SelectContent,
SelectItem,
- Tooltip
-} from "@app/components/v2";
+ SelectTrigger,
+ SelectValue,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ UnstableIconButton,
+ UnstableInput
+} from "@app/components/v3";
import {
ConditionalProjectPermissionSubject,
PermissionConditionOperators
@@ -49,30 +55,27 @@ export const ConditionsFields = ({
(errors?.permissions as any)?.[subject]?.[position]?.conditions?.root?.message;
return (
- <div className="mt-6 border-t border-t-mineshaft-600 bg-mineshaft-800 pt-2">
+ <div className="mt-6 border-t border-t-border bg-background pt-2">
<div className="flex w-full items-center justify-between">
- <div className="mt-2.5 flex items-center text-gray-300">
+ <div className="mt-2.5 flex items-center text-foreground">
<span>Conditions</span>
- <Tooltip
- className="max-w-sm"
- content={
- <>
- <p>
- Conditions determine when a policy will be applied (always if no conditions are
- present).
- </p>
- <p className="mt-3">
- All conditions must evaluate to true for the policy to take effect.
- </p>
- </>
- }
- >
- <FontAwesomeIcon size="xs" className="ml-1 text-mineshaft-400" icon={faInfoCircle} />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon className="ml-1 size-4 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm text-wrap">
+ <p>
+ Conditions determine when a policy will be applied (always if no conditions are
+ present).
+ </p>
+ <p className="mt-3">
+ All conditions must evaluate to true for the policy to take effect.
+ </p>
+ </TooltipContent>
</Tooltip>
</div>
<Button
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- variant="outline_bg"
+ variant="outline"
size="xs"
className="mt-2"
isDisabled={isDisabled}
@@ -84,6 +87,7 @@ export const ConditionsFields = ({
})
}
>
+ <PlusIcon className="size-4" />
Add Condition
</Button>
</div>
@@ -99,38 +103,39 @@ export const ConditionsFields = ({
return (
<div
key={el.id}
- className="flex items-start gap-2 bg-mineshaft-800 first:rounded-t-md last:rounded-b-md"
+ className="flex items-start gap-2 bg-background first:rounded-t-md last:rounded-b-md"
>
<div className="w-1/4">
<Controller
control={control}
name={`permissions.${subject}.${position}.conditions.${index}.lhs` as const}
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- className="mb-0"
- >
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => {
- setValue(
- `permissions.${subject}.${position}.conditions.${index}.operator` as const,
- PermissionConditionOperators.$IN as never
- );
- field.onChange(e);
- }}
- position="popper"
- className="w-full"
- >
- {selectOptions.map(({ value, label }) => (
- <SelectItem key={value} value={value}>
- {label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
+ <Field data-invalid={Boolean(error?.message)} className="mb-0">
+ <FieldContent>
+ <Select
+ value={field.value}
+ onValueChange={(e) => {
+ setValue(
+ `permissions.${subject}.${position}.conditions.${index}.operator` as const,
+ PermissionConditionOperators.$IN as never
+ );
+ field.onChange(e);
+ }}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {selectOptions.map(({ value, label }) => (
+ <SelectItem key={value} value={value}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </FieldContent>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
</div>
@@ -141,32 +146,31 @@ export const ConditionsFields = ({
`permissions.${subject}.${position}.conditions.${index}.operator` as const
}
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- className="mb-0 grow"
- >
- <Select
- position="popper"
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => field.onChange(e)}
- className="w-full"
- >
- {renderOperatorSelectItems(condition.lhs)}
- </Select>
- </FormControl>
+ <Field data-invalid={Boolean(error?.message)} className="mb-0 grow">
+ <FieldContent>
+ <Select value={field.value} onValueChange={(e) => field.onChange(e)}>
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {renderOperatorSelectItems(condition.lhs)}
+ </SelectContent>
+ </Select>
+ </FieldContent>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<div>
- <Tooltip
- asChild
- content={getConditionOperatorHelperInfo(
- condition?.operator as PermissionConditionOperators
- )}
- className="max-w-xs"
- >
- <FontAwesomeIcon icon={faInfoCircle} size="xs" className="text-bunker-400" />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon className="size-4 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs text-wrap">
+ {getConditionOperatorHelperInfo(
+ condition?.operator as PermissionConditionOperators
+ )}
+ </TooltipContent>
</Tooltip>
</div>
</div>
@@ -175,31 +179,30 @@ export const ConditionsFields = ({
control={control}
name={`permissions.${subject}.${position}.conditions.${index}.rhs` as const}
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- className="mb-0 grow"
- >
- <Input {...field} />
- </FormControl>
+ <Field data-invalid={Boolean(error?.message)} className="mb-0 grow">
+ <FieldContent>
+ <UnstableInput {...field} />
+ </FieldContent>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
</div>
- <IconButton
- ariaLabel="remove"
- variant="outline_bg"
+ <UnstableIconButton
+ aria-label="remove"
+ variant="outline"
className="p-2.5"
onClick={() => items.remove(index)}
>
- <FontAwesomeIcon icon={faTrash} />
- </IconButton>
+ <TrashIcon className="size-4" />
+ </UnstableIconButton>
</div>
);
})}
</div>
{conditionErrorMessage && (
- <div className="flex items-center space-x-2 py-2 text-sm text-gray-400">
- <FontAwesomeIcon icon={faWarning} className="text-red" />
+ <div className="flex items-center space-x-2 py-2 text-sm text-muted">
+ <TriangleAlertIcon className="text-destructive size-4" />
<span>{conditionErrorMessage}</span>
</div>
)}
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
index c930cab35d..f68c0522e1 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
@@ -1,20 +1,11 @@
import { cloneElement, useMemo, useState } from "react";
import { Control, Controller, useFieldArray, useFormContext, useWatch } from "react-hook-form";
import { components, MultiValueRemoveProps, OptionProps } from "react-select";
-import {
- faChevronDown,
- faChevronRight,
- faDiagramProject,
- faGripVertical,
- faPlus,
- faTrash
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { CheckIcon } from "lucide-react";
+import { CheckIcon, GripVerticalIcon, NetworkIcon, PlusIcon, TrashIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { Tag } from "@app/components/v2";
import {
+ Badge,
Button,
FilterableSelect,
Select,
@@ -25,10 +16,13 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
- UnstableIconButton as IconButton
+ UnstableAccordion,
+ UnstableAccordionContent,
+ UnstableAccordionItem,
+ UnstableAccordionTrigger,
+ UnstableIconButton
} from "@app/components/v3";
import { ProjectPermissionSub } from "@app/context";
-import { useToggle } from "@app/hooks";
import {
isConditionalSubjects,
@@ -38,6 +32,7 @@ import {
type Props<T extends ProjectPermissionSub> = {
title: string;
+ description: string;
subject: T;
actions: TProjectPermissionObject[T]["actions"];
children?: JSX.Element;
@@ -60,7 +55,7 @@ const OptionWithDescription = <T extends ActionOption>(props: OptionProps<T>) =>
<div className="min-w-0 flex-1">
<p className="truncate">{children}</p>
{data.description && (
- <p className="truncate text-xs leading-4 text-mineshaft-400">{data.description}</p>
+ <p className="truncate text-xs leading-4 text-muted">{data.description}</p>
)}
</div>
{isSelected && <CheckIcon className="ml-2 size-4 shrink-0" />}
@@ -171,6 +166,7 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
actions,
children,
title,
+ description,
isDisabled,
onShowAccessTree
}: Props<T>) => {
@@ -186,7 +182,6 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
name: `permissions.${subject}`
});
- const [isOpen, setIsOpen] = useToggle();
const [draggedItem, setDraggedItem] = useState<number | null>(null);
const [dragOverItem, setDragOverItem] = useState<number | null>(null);
@@ -222,149 +217,146 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
};
return (
- <div className="overflow-clip border border-mineshaft-600 bg-mineshaft-800 first:rounded-t-md last:rounded-b-md hover:bg-mineshaft-700">
- <div
- className="flex h-14 cursor-pointer items-center px-5 py-4 text-sm text-gray-300"
- role="button"
- tabIndex={0}
- onClick={() => setIsOpen.toggle()}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- setIsOpen.toggle();
- }
- }}
- >
- <FontAwesomeIcon className="mr-6 w-4" icon={isOpen ? faChevronDown : faChevronRight} />
-
- <div className="grow text-base select-none">{title}</div>
- {fields.length > 1 && (
- <div>
- <Tag size="xs" className="mr-2 px-2">
- {fields.length} Rules
- </Tag>
+ <UnstableAccordion
+ type="single"
+ collapsible
+ className="overflow-clip border border-border bg-container first:rounded-t-md last:rounded-b-md hover:bg-foreground/5"
+ >
+ <UnstableAccordionItem value={subject} className="border-0">
+ <UnstableAccordionTrigger className="min-h-14 px-5 py-4 hover:bg-foreground/5">
+ <div className="flex flex-1 items-center gap-2 text-left">
+ <div className="flex grow flex-col">
+ <span className="text-base select-none">{title}</span>
+ <span className="text-sm text-muted">{description}</span>
+ </div>
+ {fields.length > 1 && (
+ <Badge variant="neutral" className="mr-2">
+ {fields.length} Rules
+ </Badge>
+ )}
+ <div className="flex items-center gap-2">
+ {onShowAccessTree && (
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ onShowAccessTree(subject);
+ }}
+ >
+ <NetworkIcon className="size-4" />
+ Visualize Access
+ </Button>
+ )}
+ {!isDisabled && isConditionalSubjects(subject) && (
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ insert(fields.length, [
+ { read: false, edit: false, create: false, delete: false } as any
+ ]);
+ }}
+ isDisabled={isDisabled}
+ >
+ <PlusIcon className="size-4" />
+ Add Rule
+ </Button>
+ )}
+ </div>
</div>
- )}
- {isOpen && onShowAccessTree && (
- <Button
- variant="outline"
- size="xs"
- className="ml-2"
- onClick={(e) => {
- e.stopPropagation();
- onShowAccessTree(subject);
- }}
- >
- <FontAwesomeIcon icon={faDiagramProject} />
- Visualize Access
- </Button>
- )}
- {!isDisabled && isOpen && isConditionalSubjects(subject) && (
- <Button
- variant="outline"
- className="ml-2"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- insert(fields.length, [
- { read: false, edit: false, create: false, delete: false } as any
- ]);
- }}
- isDisabled={isDisabled}
- >
- <FontAwesomeIcon icon={faPlus} />
- Add Rule
- </Button>
- )}
- </div>
- {isOpen && (
- <div key={`select-${subject}-type`} className="flex flex-col space-y-3 bg-bunker-700 p-3">
- {fields.map((el, rootIndex) => {
- const isInverted = watch(`permissions.${subject}.${rootIndex}.inverted` as any);
+ </UnstableAccordionTrigger>
+ <UnstableAccordionContent className="!p-0">
+ <div key={`select-${subject}-type`} className="flex flex-col space-y-3 bg-container p-3">
+ {fields.map((el, rootIndex) => {
+ const isInverted = watch(`permissions.${subject}.${rootIndex}.inverted` as any);
- return (
- <div
- key={el.id}
- className={twMerge(
- "relative rounded-md border-l-[6px] bg-mineshaft-800 px-5 py-4 transition-colors duration-300",
- isInverted ? "border-l-red-600/50" : "border-l-green-600/50",
- dragOverItem === rootIndex ? "border-2 border-primary/50" : "",
- draggedItem === rootIndex ? "opacity-50" : ""
- )}
- onDragOver={(e) => handleDragOver(e, rootIndex)}
- onDrop={handleDrop}
- >
- <div className="flex items-center gap-3">
- {isConditionalSubjects(subject) && (
- <Controller
- defaultValue={false as any}
- name={`permissions.${subject}.${rootIndex}.inverted`}
- render={({ field }) => (
- <Select
- value={String(field.value)}
- onValueChange={(val) => field.onChange(val === "true")}
- disabled={isDisabled}
- >
- <SelectTrigger className="w-32">
- <SelectValue />
- </SelectTrigger>
- <SelectContent position="popper">
- <SelectItem value="false">Allow</SelectItem>
- <SelectItem value="true">Forbid</SelectItem>
- </SelectContent>
- </Select>
- )}
- />
+ return (
+ <div
+ key={el.id}
+ className={twMerge(
+ "relative rounded-md border-l-[6px] bg-background px-5 py-4 transition-colors duration-300",
+ isInverted ? "border-l-red-600/50" : "border-l-green-600/50",
+ dragOverItem === rootIndex ? "border-2 border-primary/50" : "",
+ draggedItem === rootIndex ? "opacity-50" : ""
)}
- <div className="flex-1">
- <ActionsMultiSelect
- subject={subject}
- rootIndex={rootIndex}
- actions={actions}
- isDisabled={isDisabled}
- control={control}
- />
+ onDragOver={(e) => handleDragOver(e, rootIndex)}
+ onDrop={handleDrop}
+ >
+ <div className="flex items-center gap-3">
+ {isConditionalSubjects(subject) && (
+ <Controller
+ defaultValue={false as any}
+ name={`permissions.${subject}.${rootIndex}.inverted`}
+ render={({ field }) => (
+ <Select
+ value={String(field.value)}
+ onValueChange={(val) => field.onChange(val === "true")}
+ disabled={isDisabled}
+ >
+ <SelectTrigger className="w-32">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ <SelectItem value="false">Allow</SelectItem>
+ <SelectItem value="true">Forbid</SelectItem>
+ </SelectContent>
+ </Select>
+ )}
+ />
+ )}
+ <div className="flex-1">
+ <ActionsMultiSelect
+ subject={subject}
+ rootIndex={rootIndex}
+ actions={actions}
+ isDisabled={isDisabled}
+ control={control}
+ />
+ </div>
+ {!isDisabled && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <UnstableIconButton
+ aria-label="Remove rule"
+ variant="danger"
+ size="xs"
+ onClick={() => remove(rootIndex)}
+ isDisabled={isDisabled}
+ >
+ <TrashIcon className="size-4" />
+ </UnstableIconButton>
+ </TooltipTrigger>
+ <TooltipContent side="top">Remove Rule</TooltipContent>
+ </Tooltip>
+ )}
+ {!isDisabled && isConditionalSubjects(subject) && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div
+ draggable
+ onDragStart={(e) => handleDragStart(e, rootIndex)}
+ onDragEnd={handleDragEnd}
+ className="cursor-move text-muted hover:text-foreground"
+ >
+ <GripVerticalIcon className="size-4" />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent side="top">Drag to reorder permission</TooltipContent>
+ </Tooltip>
+ )}
</div>
- {!isDisabled && (
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- aria-label="Remove rule"
- variant="danger"
- size="xs"
- onClick={() => remove(rootIndex)}
- isDisabled={isDisabled}
- >
- <FontAwesomeIcon icon={faTrash} />
- </IconButton>
- </TooltipTrigger>
- <TooltipContent side="top">Remove Rule</TooltipContent>
- </Tooltip>
- )}
- {!isDisabled && isConditionalSubjects(subject) && (
- <Tooltip>
- <TooltipTrigger asChild>
- <div
- draggable
- onDragStart={(e) => handleDragStart(e, rootIndex)}
- onDragEnd={handleDragEnd}
- className="cursor-move text-bunker-300 hover:text-bunker-200"
- >
- <FontAwesomeIcon icon={faGripVertical} />
- </div>
- </TooltipTrigger>
- <TooltipContent side="top">Drag to reorder permission</TooltipContent>
- </Tooltip>
- )}
+ {children &&
+ cloneElement(children, {
+ position: rootIndex
+ })}
</div>
- {children &&
- cloneElement(children, {
- position: rootIndex
- })}
- </div>
- );
- })}
- </div>
- )}
- </div>
+ );
+ })}
+ </div>
+ </UnstableAccordionContent>
+ </UnstableAccordionItem>
+ </UnstableAccordion>
);
};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PermissionConditionHelpers.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PermissionConditionHelpers.tsx
index c8408d1cf3..295e7c0764 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PermissionConditionHelpers.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PermissionConditionHelpers.tsx
@@ -1,5 +1,5 @@
import { GlobPermissionInfo } from "@app/components/permissions";
-import { SelectItem } from "@app/components/v2";
+import { SelectItem } from "@app/components/v3";
import { PermissionConditionOperators } from "@app/context/ProjectPermissionContext/types";
export const getConditionOperatorHelperInfo = (type: PermissionConditionOperators) => {
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
index eff78ef926..543f2d453d 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
@@ -1610,6 +1610,7 @@ export const EXCLUDED_PERMISSION_SUBS = [ProjectPermissionSub.SecretRollback];
export type TProjectPermissionObject = {
[K in ProjectPermissionSub]: {
title: string;
+ description: string;
actions: {
label: string;
description: string;
@@ -1624,6 +1625,7 @@ export type TProjectPermissionObject = {
export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
[ProjectPermissionSub.Secrets]: {
title: "Secrets",
+ description: "Manage secret values, metadata, and access within project environments",
actions: [
{
label: "Read (legacy)",
@@ -1661,6 +1663,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretFolders]: {
title: "Secret Folders",
+ description: "Organize secrets into hierarchical folder structures",
actions: [
{ label: "Create", value: "create", description: "Create new folders to organize secrets" },
{ label: "Modify", value: "edit", description: "Rename or modify folder properties" },
@@ -1669,6 +1672,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretImports]: {
title: "Secret Imports",
+ description: "Import and reference secrets from other environments or projects",
actions: [
{ label: "Read", value: "read", description: "View imported secrets from other projects" },
{ label: "Create", value: "create", description: "Set up new secret imports" },
@@ -1678,6 +1682,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.DynamicSecrets]: {
title: "Dynamic Secrets",
+ description: "Configure auto-rotating credentials for databases and services",
actions: [
{
label: "Read Root Credentials",
@@ -1708,6 +1713,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Cmek]: {
title: "KMS",
+ description: "Manage encryption keys and cryptographic operations",
actions: [
{
label: "Read",
@@ -1758,6 +1764,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Kms]: {
title: "Project KMS Configuration",
+ description: "Configure key management system settings for the project",
actions: [
{
label: "Modify",
@@ -1768,6 +1775,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Integrations]: {
title: "Native Integrations",
+ description: "Connect secrets to third-party services and platforms",
actions: [
{ label: "Read", value: "read", description: "View configured integrations" },
{
@@ -1781,6 +1789,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Project]: {
title: "Project",
+ description: "Manage project settings, details, and lifecycle",
actions: [
{
label: "Update project details",
@@ -1796,6 +1805,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Role]: {
title: "Roles",
+ description: "Define and configure custom permission roles",
actions: [
{ label: "Read", value: "read", description: "View roles and their permissions" },
{ label: "Create", value: "create", description: "Create new custom roles" },
@@ -1805,6 +1815,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Member]: {
title: "User Management",
+ description: "Manage project member access and role assignments",
actions: [
{
label: "Read",
@@ -1840,6 +1851,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Identity]: {
title: "Machine Identity Management",
+ description: "Manage machine identities and their access to secrets",
actions: [
{
label: "Read",
@@ -1895,6 +1907,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Groups]: {
title: "Group Management",
+ description: "Organize users into groups for bulk permission management",
actions: [
{
label: "Read",
@@ -1925,6 +1938,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Webhooks]: {
title: "Webhooks",
+ description: "Configure automated notifications for secret events",
actions: [
{ label: "Read", value: "read", description: "View configured webhooks" },
{
@@ -1938,6 +1952,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.ServiceTokens]: {
title: "Service Tokens",
+ description: "Create and manage tokens for programmatic access",
actions: [
{ label: "Read", value: "read", description: "View service tokens" },
{
@@ -1951,6 +1966,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Settings]: {
title: "Settings",
+ description: "Configure project-level settings and preferences",
actions: [
{ label: "Read", value: "read", description: "View project settings" },
{ label: "Modify", value: "edit", description: "Change project settings and configuration" }
@@ -1958,6 +1974,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Environments]: {
title: "Environment Management",
+ description: "Create and manage project environments",
actions: [
{ label: "Read", value: "read", description: "View environments (dev, staging, prod, etc.)" },
{ label: "Create", value: "create", description: "Create new environments" },
@@ -1967,6 +1984,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Commits]: {
title: "Commits",
+ description: "View and manage secret version history",
actions: [
{
label: "View",
@@ -1982,6 +2000,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Tags]: {
title: "Tags",
+ description: "Organize and categorize secrets with labels",
actions: [
{ label: "Read", value: "read", description: "View secret tags" },
{ label: "Create", value: "create", description: "Create new tags for organizing secrets" },
@@ -1991,6 +2010,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.AuditLogs]: {
title: "Audit Logs",
+ description: "View project activity and audit trail",
actions: [
{
label: "Read",
@@ -2001,6 +2021,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.IpAllowList]: {
title: "IP Allowlist",
+ description: "Restrict project access by IP address",
actions: [
{ label: "Read", value: "read", description: "View IP allowlist configuration" },
{ label: "Create", value: "create", description: "Add IP addresses to the allowlist" },
@@ -2010,6 +2031,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.CertificateAuthorities]: {
title: "Certificate Authorities",
+ description: "Manage PKI root and intermediate certificate authorities",
actions: [
{
label: "Read",
@@ -2045,6 +2067,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Certificates]: {
title: "Certificates",
+ description: "Issue and manage X.509 certificates",
actions: [
{
label: "Read",
@@ -2075,6 +2098,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.CertificateTemplates]: {
title: "Certificate Templates",
+ description: "Define templates for certificate issuance",
actions: [
{
label: "Read",
@@ -2105,6 +2129,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.CertificateProfiles]: {
title: "Certificate Profiles",
+ description: "Configure certificate profile settings",
actions: [
{
label: "Read",
@@ -2135,6 +2160,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.CertificatePolicies]: {
title: "Certificate Policies",
+ description: "Define policies for certificate lifecycle management",
actions: [
{
label: "Read",
@@ -2160,6 +2186,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SshCertificateAuthorities]: {
title: "SSH Certificate Authorities",
+ description: "Manage SSH CA for signing host and user certificates",
actions: [
{ label: "Read", value: "read", description: "View SSH certificate authorities" },
{ label: "Create", value: "create", description: "Create new SSH certificate authorities" },
@@ -2169,6 +2196,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SshCertificates]: {
title: "SSH Certificates",
+ description: "Issue and manage SSH user certificates",
actions: [
{ label: "Read", value: "read", description: "View SSH certificates" },
{ label: "Create", value: "create", description: "Issue new SSH certificates" },
@@ -2178,6 +2206,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SshCertificateTemplates]: {
title: "SSH Certificate Templates",
+ description: "Define templates for SSH certificate issuance",
actions: [
{ label: "Read", value: "read", description: "View SSH certificate templates" },
{ label: "Create", value: "create", description: "Create new SSH certificate templates" },
@@ -2187,6 +2216,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SshHosts]: {
title: "SSH Hosts",
+ description: "Manage SSH host certificates and access",
actions: [
{
label: "Read",
@@ -2217,6 +2247,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SshHostGroups]: {
title: "SSH Host Groups",
+ description: "Organize SSH hosts into groups",
actions: [
{ label: "Read", value: "read", description: "View SSH host groups" },
{ label: "Create", value: "create", description: "Create new SSH host groups" },
@@ -2226,6 +2257,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PkiSubscribers]: {
title: "PKI Subscribers",
+ description: "Manage entities that receive certificates",
actions: [
{
label: "Read",
@@ -2256,6 +2288,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PkiCollections]: {
title: "PKI Collections",
+ description: "Organize certificates into collections",
actions: [
{ label: "Read", value: "read", description: "View PKI collections" },
{ label: "Create", value: "create", description: "Create new certificate collections" },
@@ -2265,6 +2298,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PkiAlerts]: {
title: "PKI Alerts",
+ description: "Configure certificate expiration and renewal alerts",
actions: [
{ label: "Read", value: "read", description: "View PKI alerts and notifications" },
{ label: "Create", value: "create", description: "Set up new certificate expiration alerts" },
@@ -2274,6 +2308,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretApproval]: {
title: "Secret Approval Policies",
+ description: "Define approval workflows for secret access",
actions: [
{
label: "Read",
@@ -2299,6 +2334,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretRotation]: {
title: "Secret Rotation",
+ description: "Configure automatic secret rotation policies",
actions: [
{
label: "Read Config",
@@ -2334,6 +2370,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretRollback]: {
title: "Secret Rollback",
+ description: "Restore secrets to previous versions",
actions: [
{
label: "Perform rollback",
@@ -2345,6 +2382,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretSyncs]: {
title: "Secret Syncs",
+ description: "Sync secrets across environments and projects",
actions: [
{
label: "Read",
@@ -2385,6 +2423,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PkiSyncs]: {
title: "Certificate Syncs",
+ description: "Sync certificates across PKI instances",
actions: [
{
label: "Read",
@@ -2425,6 +2464,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PkiDiscovery]: {
title: "PKI Discovery",
+ description: "Discover and inventory certificates",
actions: [
{
label: "Read",
@@ -2439,6 +2479,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PkiCertificateInstallations]: {
title: "Certificate Installations",
+ description: "Install certificates to target systems",
actions: [
{ label: "Read", value: "read", description: "View certificate installation records" },
{ label: "Modify", value: "edit", description: "Update installation properties" },
@@ -2447,6 +2488,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.Kmip]: {
title: "KMIP",
+ description: "Manage keys via KMIP protocol",
actions: [
{
label: "Read Clients",
@@ -2477,6 +2519,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretScanningDataSources]: {
title: "Secret Scanning Data Sources",
+ description: "Configure data sources for secret scanning",
actions: [
{
label: "Read Data Sources",
@@ -2517,6 +2560,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretScanningFindings]: {
title: "Secret Scanning Findings",
+ description: "View and manage detected secret exposures",
actions: [
{
label: "Read Findings",
@@ -2532,6 +2576,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretScanningConfigs]: {
title: "Secret Scanning Config",
+ description: "Configure secret scanning rules and settings",
actions: [
{
label: "Read Config",
@@ -2547,6 +2592,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretEventSubscriptions]: {
title: "Secret Event Subscriptions",
+ description: "Subscribe to secret lifecycle events",
actions: [
{
label: "Subscribe to Creation Events",
@@ -2572,6 +2618,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.AppConnections]: {
title: "App Connections",
+ description: "Connect applications to access secrets",
actions: [
{
label: "Read",
@@ -2602,6 +2649,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PamFolders]: {
title: "Folders",
+ description: "Organize PAM resources into folders",
actions: [
{ label: "Read", value: ProjectPermissionActions.Read, description: "View PAM folders" },
{
@@ -2619,6 +2667,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PamResources]: {
title: "Resources",
+ description: "Manage privileged access resources",
actions: [
{ label: "Read", value: ProjectPermissionActions.Read, description: "View PAM resources" },
{
@@ -2640,6 +2689,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PamAccounts]: {
title: "Accounts",
+ description: "Manage privileged account credentials",
actions: [
{
label: "Access",
@@ -2670,6 +2720,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.PamSessions]: {
title: "Sessions",
+ description: "View and manage privileged access sessions",
actions: [
{
label: "Read",
@@ -2680,6 +2731,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.ApprovalRequests]: {
title: "Approval Requests",
+ description: "Manage and respond to access approval requests",
actions: [
{
label: "Read",
@@ -2695,6 +2747,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.ApprovalRequestGrants]: {
title: "Approval Request Grants",
+ description: "Grant or deny approval requests for access",
actions: [
{
label: "Read",
@@ -2710,6 +2763,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.McpEndpoints]: {
title: "MCP Endpoints",
+ description: "Manage Model Context Protocol endpoints",
actions: [
{
label: "Read",
@@ -2740,6 +2794,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.McpServers]: {
title: "MCP Servers",
+ description: "Configure MCP server connections",
actions: [
{ label: "Read", value: ProjectPermissionActions.Read, description: "View MCP servers" },
{
@@ -2757,6 +2812,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.McpActivityLogs]: {
title: "MCP Activity Logs",
+ description: "View MCP endpoint activity and usage",
actions: [
{
label: "Read",
@@ -2767,6 +2823,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
},
[ProjectPermissionSub.SecretApprovalRequest]: {
title: "Secret Approval Requests",
+ description: "Approve or deny requests to access secrets",
actions: [
{
label: "Read",