Skip to content

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

Hide ApprovalRequests Create action in Secret Manager project role policies

IgorHortab8c9b78bc7cc
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
index 61ae9891e9..1aade08f1b 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
@@ -29,6 +29,8 @@ type Props<T extends ProjectPermissionSub> = {
children?: JSX.Element;
isDisabled?: boolean;
onShowAccessTree?: (subject: ProjectPermissionSub) => void;
+ /** Action values to hide (e.g. ["create"]). Used to hide options in specific project contexts. */
+ hiddenActions?: string[];
};
type ActionProps = {
@@ -74,7 +76,8 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
children,
title,
isDisabled,
- onShowAccessTree
+ onShowAccessTree,
+ hiddenActions = []
}: Props<T>) => {
const { control, watch } = useFormContext<TFormSchema>();
const { fields, remove, insert, move } = useFieldArray({
@@ -293,6 +296,8 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
{actions.map(({ label, value }, index) => {
if (typeof value !== "string") return undefined;
+ if (hiddenActions.includes(value)) return null;
+
if (
subject === ProjectPermissionSub.Secrets &&
value === "read" &&
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
index 20a684548d..8cc353bbdb 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
@@ -250,6 +250,11 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
title={PROJECT_PERMISSION_OBJECT[subject].title}
key={`project-permission-${subject}`}
isDisabled={isDisabled}
+ hiddenActions={
+ subject === ProjectPermissionSub.ApprovalRequests && isSecretManagerProject
+ ? ["create"]
+ : undefined
+ }
onShowAccessTree={
[
ProjectPermissionSub.Secrets,