Skip to content

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

Continue RolePermissionsTable

Tuan Dang22878a035be2
diff --git a/backend/src/ee/services/license/licence-fns.ts b/backend/src/ee/services/license/licence-fns.ts
index 3e30276cb7..8da8afd39b 100644
--- a/backend/src/ee/services/license/licence-fns.ts
+++ b/backend/src/ee/services/license/licence-fns.ts
@@ -32,7 +32,7 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
oidcSSO: false,
scim: false,
ldap: false,
- groups: false,
+ groups: true,
status: null,
trial_end: null,
has_used_trial: true,
diff --git a/frontend/src/views/Org/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx b/frontend/src/views/Org/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
new file mode 100644
index 0000000000..4346bce3bc
--- /dev/null
+++ b/frontend/src/views/Org/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
@@ -0,0 +1,93 @@
+import { faPlus } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+// import { createNotification } from "@app/components/notifications";
+import {
+ // DeleteActionModal,
+ IconButton
+} from "@app/components/v2";
+// import { useDeleteIdentityFromWorkspace } from "@app/hooks/api";
+// import { usePopUp } from "@app/hooks/usePopUp";
+
+// import { IdentityAddToProjectModal } from "./IdentityAddToProjectModal";
+// import { IdentityProjectsTable } from "./IdentityProjectsTable";
+
+export const RolePermissionsSesction = () => {
+ // const { mutateAsync: deleteMutateAsync } = useDeleteIdentityFromWorkspace();
+
+ // const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
+ // "addIdentityToProject",
+ // "removeIdentityFromProject"
+ // ] as const);
+
+ // const onRemoveIdentitySubmit = async (id: string, projectId: string) => {
+ // try {
+ // await deleteMutateAsync({
+ // identityId: id,
+ // workspaceId: projectId
+ // });
+
+ // createNotification({
+ // text: "Successfully removed identity from project",
+ // type: "success"
+ // });
+
+ // handlePopUpClose("removeIdentityFromProject");
+ // } catch (err) {
+ // console.error(err);
+ // const error = err as any;
+ // const text = error?.response?.data?.message ?? "Failed to remove identity from project";
+
+ // createNotification({
+ // text,
+ // type: "error"
+ // });
+ // }
+ // };
+
+ return (
+ <div className="w-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="flex items-center justify-between border-b border-mineshaft-400 pb-4">
+ <h3 className="text-lg font-semibold text-mineshaft-100">Permissions</h3>
+ <IconButton
+ ariaLabel="copy icon"
+ variant="plain"
+ className="group relative"
+ onClick={() => {
+ console.log("TODO");
+ // handlePopUpOpen("addIdentityToProject");
+ }}
+ >
+ <FontAwesomeIcon icon={faPlus} />
+ </IconButton>
+ </div>
+ <div className="py-4">
+ Permissions Table
+ {/* <IdentityProjectsTable identityId={identityId} handlePopUpOpen={handlePopUpOpen} /> */}
+ </div>
+ {/* <DeleteActionModal
+ isOpen={popUp.removeIdentityFromProject.isOpen}
+ title={`Are you sure want to remove ${
+ (popUp?.removeIdentityFromProject?.data as { identityName: string })?.identityName || ""
+ } from ${
+ (popUp?.removeIdentityFromProject?.data as { projectName: string })?.projectName || ""
+ }?`}
+ onChange={(isOpen) => handlePopUpToggle("removeIdentityFromProject", isOpen)}
+ deleteKey="confirm"
+ onDeleteApproved={() => {
+ const popupData = popUp?.removeIdentityFromProject?.data as {
+ identityId: string;
+ projectId: string;
+ };
+
+ return onRemoveIdentitySubmit(popupData.identityId, popupData.projectId);
+ }}
+ /> */}
+ {/* <IdentityAddToProjectModal
+ identityId={identityId}
+ popUp={popUp}
+ handlePopUpToggle={handlePopUpToggle}
+ /> */}
+ </div>
+ );
+};
diff --git a/frontend/src/views/Org/RolePage/components/RolePermissionsSection/RolePermissionsTable.tsx b/frontend/src/views/Org/RolePage/components/RolePermissionsSection/RolePermissionsTable.tsx
new file mode 100644
index 0000000000..8cf3b857dd
--- /dev/null
+++ b/frontend/src/views/Org/RolePage/components/RolePermissionsSection/RolePermissionsTable.tsx
@@ -0,0 +1,62 @@
+import { faKey } from "@fortawesome/free-solid-svg-icons";
+
+import {
+ EmptyState,
+ Table,
+ TableContainer,
+ TableSkeleton,
+ TBody,
+ Th,
+ THead,
+ Tr
+} from "@app/components/v2";
+import { useGetIdentityProjectMemberships } from "@app/hooks/api";
+// import { UsePopUpState } from "@app/hooks/usePopUp";
+
+// import { IdentityProjectRow } from "./IdentityProjectRow";
+
+type Props = {
+ identityId: string;
+ // handlePopUpOpen: (
+ // popUpName: keyof UsePopUpState<["removeIdentityFromProject"]>,
+ // data?: {}
+ // ) => void;
+};
+
+export const IdentityProjectsTable = ({
+ identityId
+}: // handlePopUpOpen
+Props) => {
+ const { data: projectMemberships, isLoading } = useGetIdentityProjectMemberships(identityId);
+ return (
+ <TableContainer>
+ <Table>
+ <THead>
+ <Tr>
+ <Th>Name</Th>
+ <Th>Role</Th>
+ <Th>Added On</Th>
+ <Th className="w-5" />
+ </Tr>
+ </THead>
+ <TBody>
+ {isLoading && <TableSkeleton columns={2} innerKey="identity-project-memberships" />}
+ {!isLoading &&
+ projectMemberships?.map((membership) => {
+ return (
+ <div key={`membership-${membership.id}`}>Row</div>
+ // <IdentityProjectRow
+ // key={`identity-project-membership-${membership.id}`}
+ // membership={membership}
+ // handlePopUpOpen={handlePopUpOpen}
+ // />
+ );
+ })}
+ </TBody>
+ </Table>
+ {!isLoading && !projectMemberships?.length && (
+ <EmptyState title="This identity has not been assigned to any projects" icon={faKey} />
+ )}
+ </TableContainer>
+ );
+};
diff --git a/frontend/src/views/Org/RolePage/components/RolePermissionsSection/index.tsx b/frontend/src/views/Org/RolePage/components/RolePermissionsSection/index.tsx
new file mode 100644
index 0000000000..9a451ebef3
--- /dev/null
+++ b/frontend/src/views/Org/RolePage/components/RolePermissionsSection/index.tsx
@@ -0,0 +1 @@
+export { RolePermissionsSesction } from "./RolePermissionsSection";