mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 16:01:44 +00:00
feature: add org role duplication
This commit is contained in:
@@ -19,7 +19,7 @@ import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@a
|
||||
import { useDeleteProjectRole, useGetProjectRoleBySlug } from "@app/hooks/api";
|
||||
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
|
||||
import { usePopUp } from "@app/hooks/usePopUp";
|
||||
import { DuplicateRoleModal } from "@app/pages/project/RoleDetailsBySlugPage/components/DuplicateRoleModal";
|
||||
import { DuplicateProjectRoleModal } from "@app/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal";
|
||||
import { ProjectAccessControlTabs } from "@app/types/project";
|
||||
|
||||
import { RoleDetailsSection } from "./components/RoleDetailsSection";
|
||||
@@ -175,7 +175,7 @@ const Page = () => {
|
||||
deleteKey="confirm"
|
||||
onDeleteApproved={() => onDeleteRoleSubmit()}
|
||||
/>
|
||||
<DuplicateRoleModal
|
||||
<DuplicateProjectRoleModal
|
||||
isOpen={popUp.duplicateRole.isOpen}
|
||||
onOpenChange={(isOpen) => handlePopUpToggle("duplicateRole", isOpen)}
|
||||
roleSlug={roleSlug}
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ const Content = ({ role, onClose }: ContentProps) => {
|
||||
const handleDuplicateRole = async (form: FormData) => {
|
||||
try {
|
||||
const newRole = await createRole.mutateAsync({
|
||||
projectId: role.projectId,
|
||||
projectId: currentWorkspace.id,
|
||||
permissions: role.permissions,
|
||||
...form
|
||||
});
|
||||
@@ -128,7 +128,7 @@ const Content = ({ role, onClose }: ContentProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const DuplicateRoleModal = ({ isOpen, onOpenChange, roleSlug }: Props) => {
|
||||
export const DuplicateProjectRoleModal = ({ isOpen, onOpenChange, roleSlug }: Props) => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
|
||||
const { data: role, isPending } = useGetProjectRoleBySlug(currentWorkspace.id, roleSlug ?? "");
|
||||
@@ -17,7 +17,7 @@ import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const schema = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
name: z.string().min(1, "Name required"),
|
||||
description: z.string(),
|
||||
slug: slugSchema({ min: 1 })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user