Brings the unified dashboard into the open-source repo. Premium features ship in the open code, gated at runtime via NETBIRD_CLOUD and NETBIRD_LICENSED, with upgrade prompts for unlicensed self-hosted deployments. Adds the cloud-only feature areas (billing, integrations, MSP, traffic events, notifications) and the Playwright e2e suite.
79 lines
2.7 KiB
TypeScript
79 lines
2.7 KiB
TypeScript
"use client";
|
|
|
|
import Breadcrumbs from "@components/Breadcrumbs";
|
|
import InlineLink from "@components/InlineLink";
|
|
import Paragraph from "@components/Paragraph";
|
|
import SkeletonTable from "@components/skeletons/SkeletonTable";
|
|
import { RestrictedAccess } from "@components/ui/RestrictedAccess";
|
|
import { usePortalElement } from "@hooks/usePortalElement";
|
|
import useFetchApi from "@utils/api";
|
|
import { ExternalLinkIcon, User2 } from "lucide-react";
|
|
import React, { lazy, Suspense } from "react";
|
|
import TeamIcon from "@/assets/icons/TeamIcon";
|
|
import { AccountMfaCard } from "@/cloud/mfa/AccountMFACard";
|
|
import { useGroups } from "@/contexts/GroupsProvider";
|
|
import { usePermissions } from "@/contexts/PermissionsProvider";
|
|
import { User } from "@/interfaces/User";
|
|
import PageContainer from "@/layouts/PageContainer";
|
|
import { IdentityProviderCard } from "@/modules/integrations/idp-sync/IdentityProviderCard";
|
|
|
|
const UsersTable = lazy(() => import("@/modules/users/UsersTable"));
|
|
|
|
export default function TeamUsers() {
|
|
const { isLoading: isGroupsLoading } = useGroups();
|
|
const { permission } = usePermissions();
|
|
const { data: users, isLoading } = useFetchApi<User[]>(
|
|
"/users?service_user=false",
|
|
);
|
|
|
|
const { ref: headingRef, portalTarget } =
|
|
usePortalElement<HTMLHeadingElement>();
|
|
|
|
return (
|
|
<PageContainer>
|
|
<div className={"p-default py-6"}>
|
|
<Breadcrumbs>
|
|
<Breadcrumbs.Item
|
|
href={"/team"}
|
|
label={"Team"}
|
|
icon={<TeamIcon size={13} />}
|
|
/>
|
|
<Breadcrumbs.Item
|
|
href={"/team/users"}
|
|
label={"Users"}
|
|
active
|
|
icon={<User2 size={16} />}
|
|
/>
|
|
</Breadcrumbs>
|
|
<h1 ref={headingRef}>Users</h1>
|
|
<Paragraph>
|
|
Manage users and their permissions. Same-domain email users are added
|
|
automatically on first sign-in.{" "}
|
|
<InlineLink
|
|
href={"https://docs.netbird.io/how-to/add-users-to-your-network"}
|
|
target={"_blank"}
|
|
>
|
|
Learn more
|
|
<ExternalLinkIcon size={12} />
|
|
</InlineLink>
|
|
</Paragraph>
|
|
</div>
|
|
<RestrictedAccess page={"Users"} hasAccess={permission.users.read}>
|
|
<Suspense fallback={<SkeletonTable />}>
|
|
{permission.settings.read && (
|
|
<div className={"flex flex-wrap gap-4 p-default pb-6"}>
|
|
{permission?.idp?.read && <IdentityProviderCard />}
|
|
<AccountMfaCard />
|
|
</div>
|
|
)}
|
|
<UsersTable
|
|
users={users}
|
|
isLoading={isLoading || isGroupsLoading}
|
|
headingTarget={portalTarget}
|
|
/>
|
|
</Suspense>
|
|
</RestrictedAccess>
|
|
</PageContainer>
|
|
);
|
|
}
|