Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Adjust OrgRoleTable
Tuan Dang29d76c1deb22
diff --git a/frontend/src/views/Org/MembersPage/components/OrgRoleTabSection/OrgRoleTable.tsx b/frontend/src/views/Org/MembersPage/components/OrgRoleTabSection/OrgRoleTable.tsxindex 904aec264b..da7829344e 100644--- a/frontend/src/views/Org/MembersPage/components/OrgRoleTabSection/OrgRoleTable.tsx+++ b/frontend/src/views/Org/MembersPage/components/OrgRoleTabSection/OrgRoleTable.tsx@@ -110,8 +110,6 @@ export const OrgRoleTable = () => {<OrgPermissionCanI={OrgPermissionActions.Edit}a={OrgPermissionSubjects.Role}- renderTooltip- allowedLabel="Edit">{(isAllowed) => (<DropdownMenuItem@@ -121,39 +119,36 @@ export const OrgRoleTable = () => {onClick={(e) => {e.stopPropagation();router.push(`/org/${orgId}/roles/${id}`);- // onSelectRole(role);}}disabled={!isAllowed}>- Edit Role- </DropdownMenuItem>- )}- </OrgPermissionCan>- <OrgPermissionCan- I={OrgPermissionActions.Delete}- a={OrgPermissionSubjects.Role}- renderTooltip- allowedLabel={- isNonMutatable ? "Reserved roles are non-removable" : "Delete"- }- >- {(isAllowed) => (- <DropdownMenuItem- className={twMerge(- isAllowed- ? "hover:!bg-red-500 hover:!text-white"- : "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={(e) => {- e.stopPropagation();- handlePopUpOpen("deleteRole", role);- }}- disabled={!isAllowed}- >- Delete Role+ {`${isNonMutatable ? "View" : "Edit"} Role`}</DropdownMenuItem>)}</OrgPermissionCan>+ {!isNonMutatable && (+ <OrgPermissionCan+ I={OrgPermissionActions.Delete}+ a={OrgPermissionSubjects.Role}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ className={twMerge(+ isAllowed+ ? "hover:!bg-red-500 hover:!text-white"+ : "pointer-events-none cursor-not-allowed opacity-50"+ )}+ onClick={(e) => {+ e.stopPropagation();+ handlePopUpOpen("deleteRole", role);+ }}+ disabled={!isAllowed}+ >+ Delete Role+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ )}</DropdownMenuContent></DropdownMenu></Td>diff --git a/frontend/src/views/Org/RolePage/RolePage.tsx b/frontend/src/views/Org/RolePage/RolePage.tsxindex 0983d35065..c8e78a54ee 100644--- a/frontend/src/views/Org/RolePage/RolePage.tsx+++ b/frontend/src/views/Org/RolePage/RolePage.tsx@@ -17,7 +17,7 @@ import {} from "@app/components/v2";import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";import { withPermission } from "@app/hoc";-import { useDeleteOrgRole,useGetOrgRole } from "@app/hooks/api";+import { useDeleteOrgRole, useGetOrgRole } from "@app/hooks/api";import { usePopUp } from "@app/hooks/usePopUp";import { RoleDetailsSection, RoleModal, RolePermissionsSection } from "./components";@@ -64,6 +64,8 @@ export const RolePage = withPermission(}};+ const isCustomRole = !["admin", "member", "no-access"].includes(data?.slug ?? "");+return (<div className="container mx-auto flex flex-col justify-between bg-bunker-800 text-white">{data && (@@ -81,51 +83,56 @@ export const RolePage = withPermission(</Button><div className="mb-4 flex items-center justify-between"><p className="text-3xl font-semibold text-white">{data.name}</p>- <DropdownMenu>- <DropdownMenuTrigger asChild className="rounded-lg">- <div className="hover:text-primary-400 data-[state=open]:text-primary-400">- <Tooltip content="More options">- <FontAwesomeIcon size="sm" icon={faEllipsis} />- </Tooltip>- </div>- </DropdownMenuTrigger>- <DropdownMenuContent align="start" className="p-1">- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Role}>- {(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={async () => {- handlePopUpOpen("role", {- roleId- });- }}- disabled={!isAllowed}- >- Edit Role- </DropdownMenuItem>- )}- </OrgPermissionCan>- <OrgPermissionCan I={OrgPermissionActions.Delete} a={OrgPermissionSubjects.Role}>- {(isAllowed) => (- <DropdownMenuItem- className={twMerge(- isAllowed- ? "hover:!bg-red-500 hover:!text-white"- : "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={async () => {- handlePopUpOpen("deleteOrgRole");- }}- disabled={!isAllowed}- >- Delete Role- </DropdownMenuItem>- )}- </OrgPermissionCan>- </DropdownMenuContent>- </DropdownMenu>+ {isCustomRole && (+ <DropdownMenu>+ <DropdownMenuTrigger asChild className="rounded-lg">+ <div className="hover:text-primary-400 data-[state=open]:text-primary-400">+ <Tooltip content="More options">+ <FontAwesomeIcon size="sm" icon={faEllipsis} />+ </Tooltip>+ </div>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="p-1">+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Role}>+ {(isAllowed) => (+ <DropdownMenuItem+ className={twMerge(+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"+ )}+ onClick={async () => {+ handlePopUpOpen("role", {+ roleId+ });+ }}+ disabled={!isAllowed}+ >+ Edit Role+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ <OrgPermissionCan+ I={OrgPermissionActions.Delete}+ a={OrgPermissionSubjects.Role}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ className={twMerge(+ isAllowed+ ? "hover:!bg-red-500 hover:!text-white"+ : "pointer-events-none cursor-not-allowed opacity-50"+ )}+ onClick={async () => {+ handlePopUpOpen("deleteOrgRole");+ }}+ disabled={!isAllowed}+ >+ Delete Role+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ )}</div><div className="flex"><div className="mr-4 w-96">