mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
refactor: share sender group policy evaluation
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
ChannelGroupContext,
|
||||
GroupToolPolicyConfig,
|
||||
} from "openclaw/plugin-sdk/feishu";
|
||||
import { evaluateSenderGroupAccessForPolicy } from "openclaw/plugin-sdk/feishu";
|
||||
import { normalizeFeishuTarget } from "./targets.js";
|
||||
import type { FeishuConfig, FeishuGroupConfig } from "./types.js";
|
||||
|
||||
@@ -98,14 +99,12 @@ export function isFeishuGroupAllowed(params: {
|
||||
senderIds?: Array<string | null | undefined>;
|
||||
senderName?: string | null;
|
||||
}): boolean {
|
||||
const { groupPolicy } = params;
|
||||
if (groupPolicy === "disabled") {
|
||||
return false;
|
||||
}
|
||||
if (groupPolicy === "open" || groupPolicy === "allowall") {
|
||||
return true;
|
||||
}
|
||||
return resolveFeishuAllowlistMatch(params).allowed;
|
||||
return evaluateSenderGroupAccessForPolicy({
|
||||
groupPolicy: params.groupPolicy === "allowall" ? "open" : params.groupPolicy,
|
||||
groupAllowFrom: params.allowFrom.map((entry) => String(entry)),
|
||||
senderId: params.senderId,
|
||||
isSenderAllowed: () => resolveFeishuAllowlistMatch(params).allowed,
|
||||
}).allowed;
|
||||
}
|
||||
|
||||
export function resolveFeishuReplyPolicy(params: {
|
||||
|
||||
Reference in New Issue
Block a user