feat(secret-approval): added permission for policy management and fixed bugs on fellow user reviewing secrets

This commit is contained in:
Akhil Mohan
2023-10-05 20:34:50 +05:30
parent 9dc97f7208
commit df636c91b4
13 changed files with 128 additions and 50 deletions
@@ -9,6 +9,7 @@ import {
faLock,
faNetworkWired,
faPuzzlePiece,
faShield,
faTags,
faUser,
faUsers
@@ -18,7 +19,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
import { Button, FormControl, Input, UpgradePlanModal } from "@app/components/v2";
import { useOrganization, useSubscription, useWorkspace } from "@app/context";
import { ProjectPermissionSub, useOrganization, useSubscription, useWorkspace } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useCreateRole, useUpdateRole } from "@app/hooks/api";
import { TRole } from "@app/hooks/api/roles/types";
@@ -41,6 +42,12 @@ const SINGLE_PERMISSION_LIST = [
icon: faPuzzlePiece,
formName: "integrations"
},
{
title: "Secret Protect policy",
subtitle: "Manage policies for secret protection for unauthorized secret changes",
icon: faShield,
formName: ProjectPermissionSub.SecretApproval
},
{
title: "Roles",
subtitle: "Role management control",
@@ -1,6 +1,7 @@
/* eslint-disable no-param-reassign */
import { z } from "zod";
import { ProjectPermissionSub } from "@app/context";
import { TProjectPermission } from "@app/hooks/api/roles/types";
const generalPermissionSchema = z
@@ -41,6 +42,8 @@ export const formSchema = z.object({
tags: generalPermissionSchema,
"audit-logs": generalPermissionSchema,
"ip-allowlist": generalPermissionSchema,
// akhilmhdh: refactor all keys like below
[ProjectPermissionSub.SecretApproval]: generalPermissionSchema,
workspace: z
.object({
edit: z.boolean().optional(),
@@ -6,6 +6,7 @@ import { motion } from "framer-motion";
import { twMerge } from "tailwind-merge";
import { Checkbox, Select, SelectItem } from "@app/components/v2";
import { ProjectPermissionSub } from "@app/context";
import { useToggle } from "@app/hooks";
import { TFormSchema } from "./ProjectRoleModifySection.utils";
@@ -21,7 +22,8 @@ type Props = {
| "environments"
| "tags"
| "audit-logs"
| "ip-allowlist";
| "ip-allowlist"
| ProjectPermissionSub.SecretApproval;
isNonEditable?: boolean;
setValue: UseFormSetValue<TFormSchema>;
control: Control<TFormSchema>;