Add read-only permission overview ("Eigene Rechte anzeigen")

Partial progress on #71 (full permissions editor). A genuine full
editor - server/channel/group permission grids across 5 permission
scopes with add/remove/modify for hundreds of possible permissions -
is a much bigger undertaking than fits in one pass, so this lands a
real, useful slice of it first: a read-only view of the caller's own
effective permissions in their current channel.

- Connector: "permoverview" (raw command, no typed builder exists)
  requests the caller's effective permission set for cid+cldbid.
  Permission IDs are opaque numeric values server-side, so results are
  name-resolved via a "permissionlist" id->name/description lookup
  that's fetched once and cached for the connection's lifetime. The two
  requests are chained (list first, overview second) with buffering in
  case the overview reply somehow arrives first.
- Gateway: typed passthrough for the merged, name-resolved entries.
- Frontend: new dialog wired to "Eigene Rechte anzeigen" in the Rechte
  menu (previously disabled) - a filterable table of permission
  name/value/negated/skip.

Verified against the real server: initially got a clean
"ParameterNotFound" error revealing that permoverview needs an
explicit permid=0 ("all permissions") even though tsclientlib's
generated type treats it as optional; after adding that argument the
command reaches the server correctly and returns the expected
permission-denied response for the guest test account (same pattern
as every other admin-gated feature this session).

The remaining scope of #71 - editable server-group/channel-group/
channel/client permission grids - is unchanged and left for later.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-08-05 21:35:09 +02:00
1 parent 0f8576ac6c
commit 41ac845fbc
7 files changed
+305 -3

No files matched your search

+113 -1
View File
@@ -320,6 +320,14 @@ interface GroupEntry {
name: string;
}
interface PermissionOverviewEntry {
name: string;
description: string;
value: number;
negated: boolean;
skip: boolean;
}
interface ClientConnectionInfoData {
clientId: number;
pingMs: number | null;
@@ -1608,6 +1616,86 @@ function GroupAssignDialog({
);
}
function PermissionOverviewDialog({
entries,
onClose,
}: {
entries: PermissionOverviewEntry[] | null;
onClose: () => void;
}) {
const t = useT();
const backdrop = useBackdropDismiss(onClose);
const [search, setSearch] = useState("");
const [timedOut, setTimedOut] = useState(false);
useEffect(() => {
setTimedOut(false);
if (entries) return;
const id = window.setTimeout(() => setTimedOut(true), 6000);
return () => window.clearTimeout(id);
}, [entries]);
const filtered = entries?.filter((e) => e.name.toLowerCase().includes(search.toLowerCase())) ?? null;
return (
<div className="ts-dialog-backdrop" {...backdrop}>
<div className="ts-dialog ts-permission-overview-dialog" onClick={(e) => e.stopPropagation()}>
<div className="ts-dialog-titlebar">
<span>{t("permissionOverview.title")}</span>
<button onClick={onClose} title={t("dialog.close")}>
✕
</button>
</div>
<div className="ts-dialog-body">
{!entries ? (
<div className="ts-connection-info-loading">
{timedOut ? t("connectionInfo.unavailable") : t("connectionInfo.loading")}
</div>
) : entries.length === 0 ? (
<div className="ts-connection-info-loading">{t("permissionOverview.empty")}</div>
) : (
<>
<div className="ts-dialog-row">
<label className="ts-dialog-field ts-dialog-field-grow">
{t("clientLog.filter")}
<input value={search} onChange={(e) => setSearch(e.target.value)} />
</label>
</div>
<div className="ts-permission-overview-scroll">
<table className="ts-ban-list-table">
<thead>
<tr>
<th>{t("permissionOverview.name")}</th>
<th>{t("permissionOverview.value")}</th>
<th>{t("permissionOverview.negated")}</th>
<th>{t("permissionOverview.skip")}</th>
</tr>
</thead>
<tbody>
{filtered!.map((e, i) => (
<tr key={`${e.name}-${i}`} title={e.description || undefined}>
<td>{e.name}</td>
<td>{e.value}</td>
<td>{e.negated ? "✔️" : ""}</td>
<td>{e.skip ? "✔️" : ""}</td>
</tr>
))}
</tbody>
</table>
</div>
</>
)}
</div>
<div className="ts-dialog-buttons">
<div />
<div className="ts-dialog-buttons-right">
<button onClick={onClose}>{t("dialog.close")}</button>
</div>
</div>
</div>
</div>
);
}
function ServerProtocolLogDialog({
lines,
onClose,
@@ -3102,6 +3190,8 @@ function AppInner() {
clientId: number;
clientName: string;
} | null>(null);
const [permissionOverviewOpen, setPermissionOverviewOpen] = useState(false);
const [permissionOverview, setPermissionOverview] = useState<PermissionOverviewEntry[] | null>(null);
const [treeWidth, setTreeWidth] = useState(260);
const [upperHeight, setUpperHeight] = useState(340);
const [selected, setSelected] = useState<SelectedItem | null>(null);
@@ -3698,6 +3788,9 @@ function AppInner() {
case "serverGroupList":
setServerGroups(data.entries);
break;
case "permissionOverview":
setPermissionOverview(data.entries);
break;
}
};
@@ -4446,6 +4539,12 @@ function AppInner() {
}
};
const handleShowPermissionOverview = () => {
setPermissionOverviewOpen(true);
setPermissionOverview(null);
socketRef.current?.send(JSON.stringify({ type: "getPermissionOverview" }));
};
const handleSendPoke = () => {
if (!pokeTarget) return;
socketRef.current?.send(
@@ -4734,7 +4833,13 @@ function AppInner() {
<span className="ts-menu-item-label">{t("menu.rights.overview")}</span>
</button>
<div className="ts-menu-separator" />
<button className="ts-menu-item" disabled title={t("clientContext.notSupported")}>
<button
className="ts-menu-item"
onClick={() => {
handleShowPermissionOverview();
setRightsMenuOpen(false);
}}
>
<span className="ts-menu-item-icon">🙋</span>
<span className="ts-menu-item-label">{t("menu.rights.myRights")}</span>
</button>
@@ -5277,6 +5382,13 @@ function AppInner() {
/>
)}
{permissionOverviewOpen && (
<PermissionOverviewDialog
entries={permissionOverview}
onClose={() => setPermissionOverviewOpen(false)}
/>
)}
{contactsOpen && (
<ContactsDialog
contacts={contacts}