mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
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:
1 parent
0f8576ac6c
commit
41ac845fbc
7 files changed
+305
-3
No files matched your search
@@ -43,6 +43,14 @@ export interface GroupEntry {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PermissionOverviewEntry {
|
||||
name: string;
|
||||
description: string;
|
||||
value: number;
|
||||
negated: boolean;
|
||||
skip: boolean;
|
||||
}
|
||||
|
||||
export interface BanListEntry {
|
||||
banId: number;
|
||||
ip: string;
|
||||
@@ -142,7 +150,8 @@ export type Ts3ConnectionEvent =
|
||||
timestamp: string;
|
||||
}
|
||||
| { type: "channelGroupList"; entries: GroupEntry[] }
|
||||
| { type: "serverGroupList"; entries: GroupEntry[] };
|
||||
| { type: "serverGroupList"; entries: GroupEntry[] }
|
||||
| { type: "permissionOverview"; entries: PermissionOverviewEntry[] };
|
||||
|
||||
export interface Ts3ConnectOptions {
|
||||
host: string;
|
||||
@@ -307,7 +316,11 @@ export class Ts3Connection {
|
||||
timestamp: string;
|
||||
}
|
||||
| { type: "channelGroupList"; entries: { id: number; name: string }[] }
|
||||
| { type: "serverGroupList"; entries: { id: number; name: string }[] };
|
||||
| { type: "serverGroupList"; entries: { id: number; name: string }[] }
|
||||
| {
|
||||
type: "permissionOverview";
|
||||
entries: { name: string; description: string; value: number; negated: boolean; skip: boolean }[];
|
||||
};
|
||||
|
||||
if (event.type === "connected") {
|
||||
this.emit({
|
||||
@@ -579,6 +592,10 @@ export class Ts3Connection {
|
||||
this.child?.stdin.write(`serverquerylogin ${u} ${p}\n`);
|
||||
}
|
||||
|
||||
async getPermissionOverview(): Promise<void> {
|
||||
this.child?.stdin.write(`permoverview\n`);
|
||||
}
|
||||
|
||||
async sendChatMessage(message: string): Promise<void> {
|
||||
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
|
||||
if (sanitized) this.child?.stdin.write(`chat ${sanitized}\n`);
|
||||
|
||||
Reference in new issue
Block a user