refactor: share sender group policy evaluation

This commit is contained in:
Peter Steinberger
2026-03-07 23:12:09 +00:00
parent d228a62143
commit 8c15b8600c
4 changed files with 22 additions and 27 deletions

View File

@@ -10,6 +10,7 @@ import type {
} from "openclaw/plugin-sdk/msteams";
import {
buildChannelKeyCandidates,
evaluateSenderGroupAccessForPolicy,
normalizeChannelSlug,
resolveAllowlistMatchSimple,
resolveToolsBySender,
@@ -248,12 +249,10 @@ export function isMSTeamsGroupAllowed(params: {
senderName?: string | null;
allowNameMatching?: boolean;
}): boolean {
const { groupPolicy } = params;
if (groupPolicy === "disabled") {
return false;
}
if (groupPolicy === "open") {
return true;
}
return resolveMSTeamsAllowlistMatch(params).allowed;
return evaluateSenderGroupAccessForPolicy({
groupPolicy: params.groupPolicy,
groupAllowFrom: params.allowFrom.map((entry) => String(entry)),
senderId: params.senderId,
isSenderAllowed: () => resolveMSTeamsAllowlistMatch(params).allowed,
}).allowed;
}