SSL group-access.ts
Interaktion und PortierbarkeitJAVA
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import type { ChannelGroupPolicy } from "openclaw/plugin-sdk/config-runtime"; import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/config-runtime"; import type {
TelegramAccountConfig,
TelegramDirectConfig,
TelegramGroupConfig,
TelegramTopicConfig,
} from "openclaw/plugin-sdk/config-runtime"; import { evaluateMatchedGroupAccessForPolicy } from "openclaw/plugin-sdk/group-access"; import { isSenderAllowed, type NormalizedAllowFrom } from "./bot-access.js"; import { firstDefined } from "./bot-access.js";
export type TelegramGroupBaseBlockReason =
| "group-disabled"
| "topic-disabled"
| "group-override-unauthorized";
if (!params.isGroup || !params.enforcePolicy) { return { allowed: true, groupPolicy };
} if (groupPolicy === "disabled") { return { allowed: false, reason: "group-policy-disabled", groupPolicy };
} // Check chat-level allowlist first so that groups explicitly listed in the // `groups` config are not blocked by the sender-level "empty allowlist" guard.
let chatExplicitlyAllowed = false; if (params.checkChatAllowlist) { const groupAllowlist = params.resolveGroupPolicy(params.chatId); if (groupAllowlist.allowlistEnabled && !groupAllowlist.allowed) { return { allowed: false, reason: "group-chat-not-allowed", groupPolicy };
} // The chat is explicitly allowed when it has a dedicated entry in the groups // config (groupConfig is set). A wildcard ("*") match alone does not count // because it only enables the group — sender-level filtering still applies. if (groupAllowlist.allowlistEnabled && groupAllowlist.allowed && groupAllowlist.groupConfig) {
chatExplicitlyAllowed = true;
}
} if (groupPolicy === "allowlist" && params.enforceAllowlistAuthorization) { const senderId = params.senderId ?? ""; const senderAuthorization = evaluateMatchedGroupAccessForPolicy({
groupPolicy,
requireMatchInput: params.requireSenderForAllowlistAuthorization,
hasMatchInput: Boolean(senderId),
allowlistConfigured:
chatExplicitlyAllowed ||
params.allowEmptyAllowlistEntries ||
params.effectiveGroupAllow.hasEntries,
allowlistMatched:
(chatExplicitlyAllowed && !params.effectiveGroupAllow.hasEntries) ||
isSenderAllowed({
allow: params.effectiveGroupAllow,
senderId,
senderUsername: params.senderUsername ?? "",
}),
}); if (!senderAuthorization.allowed && senderAuthorization.reason === "missing_match_input") { return { allowed: false, reason: "group-policy-allowlist-no-sender", groupPolicy };
} if (!senderAuthorization.allowed && senderAuthorization.reason === "empty_allowlist") { return { allowed: false, reason: "group-policy-allowlist-empty", groupPolicy };
} if (!senderAuthorization.allowed && senderAuthorization.reason === "not_allowlisted") { return { allowed: false, reason: "group-policy-allowlist-unauthorized", groupPolicy };
}
} return { allowed: true, groupPolicy };
};
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.