Move Authentik users and groups to their own tab

Apps → Authentik now has two tabs for administrators: Status (the outposts,
certificates, tokens and alerts, as before) and Users and groups (New user,
Users and Groups). The tab is a ?view=users link like the other pages' tabs;
everyone else sees only the status. Docs updated to name the tab.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-01 01:08:07 +01:00
1 parent c9385387bc
commit 655b1443ec
5 files changed
+63 -17

No files matched your search

+56 -10
View File
@@ -1,8 +1,9 @@
import { useCallback, useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { Link, useSearchParams } from "react-router-dom";
import { api, type AuthentikInfo, type CurrentUser } from "../api/client";
import AuthentikNewUser from "../components/AuthentikNewUser";
import AuthentikGroupList from "../components/AuthentikGroupList";
import ViewTabs from "../components/ViewTabs";
import AuthentikUserList from "../components/AuthentikUserList";
import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo";
@@ -25,7 +26,7 @@ function Left({ days, warn, critical }: { days: number; warn: number; critical:
return <span className={days <= critical ? "text-red" : days <= warn ? "text-yellow" : "text-secondary"}>{text}</span>;
}
function Card({ a, isAdmin, onChanged }: { a: AuthentikInfo; isAdmin: boolean; onChanged: () => void }) {
function Card({ a }: { a: AuthentikInfo }) {
const s = a.state;
return (
<div className="card mb-3">
@@ -129,9 +130,28 @@ function Card({ a, isAdmin, onChanged }: { a: AuthentikInfo; isAdmin: boolean; o
{s.lastConfigError && <div className="text-secondary small">Latest configuration error: {s.lastConfigError}</div>}
</>
)}
{isAdmin && a.enabled && <AuthentikNewUser a={a} onChanged={onChanged} />}
{isAdmin && a.enabled && <AuthentikUserList a={a} />}
{isAdmin && a.enabled && <AuthentikGroupList a={a} />}
</div>
</div>
);
}
/** What an administrator can do in one Authentik: make users, look after them and look after groups. */
function ManageCard({ a, onChanged }: { a: AuthentikInfo; onChanged: () => void }) {
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">{a.name}</h3>
</div>
<div className="card-body">
{a.enabled ? (
<>
<AuthentikNewUser a={a} onChanged={onChanged} />
<AuthentikUserList a={a} />
<AuthentikGroupList a={a} />
</>
) : (
<div className="text-secondary">Switched off under Integrations.</div>
)}
</div>
</div>
);
@@ -139,6 +159,10 @@ function Card({ a, isAdmin, onChanged }: { a: AuthentikInfo; isAdmin: boolean; o
/** Authentik, the front door: whether its outposts are reporting, what is about to run out, whether a worker is connected, and who is failing to sign in. */
export default function Authentik({ user }: { user: CurrentUser }) {
const isAdmin = user.role === "admin";
const [params] = useSearchParams();
// The second tab is for an administrator: everything on it is theirs alone.
const view = isAdmin && params.get("view") === "users" ? "users" : "status";
const [data, setData] = useState<AuthentikInfo[] | null>(null);
const [error, setError] = useState<string | null>(null);
const load = useCallback(
@@ -160,10 +184,32 @@ export default function Authentik({ user }: { user: CurrentUser }) {
return (
<>
<h2 className="page-title">Authentik</h2>
<p className="text-secondary">
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">Integrations</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">Alerts</Link>.{user.role === "admin" && " An administrator can also make a user here, with a one-time link for them to choose a password, and switch users off or delete them, and make and rename groups and change who is in them."}
</p>
{isAdmin && (
<ViewTabs
label="Authentik view"
tabs={[
{ to: "/authentik", label: "Status", active: view === "status" },
{ to: "/authentik?view=users", label: "Users and groups", active: view === "users" },
]}
/>
)}
{view === "status" ? (
<p className="text-secondary">
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">Integrations</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
{isAdmin && (
<>
{" "}
Making users and looking after users and groups is under <Link to="/authentik?view=users">Users and groups</Link>.
</>
)}
</p>
) : (
<p className="text-secondary">
Make a user — with a one-time link for them to choose their own password — switch users off, edit or delete them, and make and rename groups and change who is in them. It needs a token that may do that on the integration (<Link to="/integrations">Integrations</Link> → edit),
and everything done here is written in the audit log.
</p>
)}
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
{data && data.length === 0 && (
@@ -173,7 +219,7 @@ export default function Authentik({ user }: { user: CurrentUser }) {
</div>
</div>
)}
{data?.map((a) => <Card key={a.id} a={a} isAdmin={user.role === "admin"} onChanged={() => void load()} />)}
{data?.map((a) => (view === "users" ? <ManageCard key={a.id} a={a} onChanged={() => void load()} /> : <Card key={a.id} a={a} />))}
</>
);
}