Skip to content

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

fix: adding badge for managed by groups

IgorHorta8b1a7ea6520b
diff --git a/backend/src/services/org/org-dal.ts b/backend/src/services/org/org-dal.ts
index c501e3fb16..6a93f85ee6 100644
--- a/backend/src/services/org/org-dal.ts
+++ b/backend/src/services/org/org-dal.ts
@@ -667,8 +667,7 @@ export const orgDALFactory = (db: TDbClient) => {
/**
* Returns all effective org memberships for an actor (user or identity) in the org: direct
- * membership and any memberships via groups the actor belongs to. Single query (permission-DAL style).
- * Useful when the actor can have multiple memberships (e.g. direct + group, or multiple groups).
+ * membership and any memberships via groups the actor belongs to. Single query
*/
const findEffectiveOrgMemberships = async (dto: {
actorType: ActorType;
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsTable.tsx
index d2ffc94810..ef3370f717 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsTable.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsTable.tsx
@@ -36,6 +36,7 @@ import {
THead,
Tr
} from "@app/components/v2";
+import { Badge, OrgIcon, SubOrgIcon } from "@app/components/v3";
import { OrgPermissionGroupActions, OrgPermissionSubjects, useOrganization } from "@app/context";
import {
getUserTablePreference,
@@ -224,16 +225,20 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
</IconButton>
</div>
</Th>
+ {isSubOrganization && <Th>Managed By</Th>}
<Th className="w-5" />
</Tr>
</THead>
<TBody>
- {isPending && <TableSkeleton columns={4} innerKey="org-groups" />}
+ {isPending && (
+ <TableSkeleton columns={isSubOrganization ? 5 : 4} innerKey="org-groups" />
+ )}
{!isPending &&
filteredGroups
.slice(offset, perPage * page)
.map(({ id, name, slug, role, customRole, orgId: groupOrgId }) => {
const isLinkedGroup = currentOrg ? groupOrgId !== currentOrg.id : false;
+ const isManagedBySubOrg = currentOrg ? groupOrgId === currentOrg.id : false;
return (
<Tr
onClick={() =>
@@ -280,6 +285,23 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
}}
</OrgPermissionCan>
</Td>
+ {isSubOrganization && (
+ <Td>
+ <Badge variant={isManagedBySubOrg ? "sub-org" : "org"}>
+ {isManagedBySubOrg ? (
+ <>
+ <SubOrgIcon />
+ Sub-Organization
+ </>
+ ) : (
+ <>
+ <OrgIcon />
+ Root Organization
+ </>
+ )}
+ </Badge>
+ </Td>
+ )}
<Td>
<DropdownMenu>
<DropdownMenuTrigger asChild>
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupDetailsSection.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupDetailsSection.tsx
index c884b00810..6ad9a8adfd 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupDetailsSection.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupDetailsSection.tsx
@@ -4,10 +4,13 @@ import { CheckIcon, ClipboardListIcon, PencilIcon } from "lucide-react";
import { OrgPermissionCan } from "@app/components/permissions";
import { Tooltip } from "@app/components/v2";
import {
+ Badge,
Detail,
DetailGroup,
DetailLabel,
DetailValue,
+ OrgIcon,
+ SubOrgIcon,
UnstableCard,
UnstableCardAction,
UnstableCardContent,
@@ -16,7 +19,7 @@ import {
UnstableCardTitle,
UnstableIconButton
} from "@app/components/v3";
-import { OrgPermissionGroupActions, OrgPermissionSubjects } from "@app/context";
+import { OrgPermissionGroupActions, OrgPermissionSubjects, useOrganization } from "@app/context";
import { useTimedReset } from "@app/hooks";
import { useGetGroupById } from "@app/hooks/api/";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -29,6 +32,7 @@ type Props = {
export const GroupDetailsSection = ({ groupId, handlePopUpOpen, canEditGroup = true }: Props) => {
const { data } = useGetGroupById(groupId);
+ const { currentOrg, isSubOrganization } = useOrganization();
const [, isCopyingId, setCopyTextId] = useTimedReset<string>({
initialState: "Copy ID to clipboard"
@@ -113,6 +117,24 @@ export const GroupDetailsSection = ({ groupId, handlePopUpOpen, canEditGroup = t
<DetailLabel>Organization Role</DetailLabel>
<DetailValue>{data.group.role}</DetailValue>
</Detail>
+ {isSubOrganization && currentOrg && (
+ <Detail>
+ <DetailLabel>Managed By</DetailLabel>
+ <DetailValue>
+ {data.group.orgId === currentOrg.id ? (
+ <Badge variant="sub-org">
+ <SubOrgIcon />
+ Sub-Organization
+ </Badge>
+ ) : (
+ <Badge variant="org">
+ <OrgIcon />
+ Root Organization
+ </Badge>
+ )}
+ </DetailValue>
+ </Detail>
+ )}
<Detail>
<DetailLabel>Created</DetailLabel>
<DetailValue>{format(data.group.createdAt, "PPpp")}</DetailValue>