refactor: share sender-scoped group policy derivation

This commit is contained in:
Peter Steinberger
2026-03-07 22:49:30 +00:00
parent 621063a956
commit 5bbca5be91
9 changed files with 63 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ import {
issuePairingChallenge,
readStoreAllowFromForDmPolicy,
resolveDmGroupAccessWithLists,
resolveSenderScopedGroupPolicy,
} from "openclaw/plugin-sdk/matrix";
import {
normalizeMatrixAllowList,
@@ -32,12 +33,10 @@ export async function resolveMatrixAccessState(params: {
})
: [];
const normalizedGroupAllowFrom = normalizeMatrixAllowList(params.groupAllowFrom);
const senderGroupPolicy =
params.groupPolicy === "disabled"
? "disabled"
: normalizedGroupAllowFrom.length > 0
? "allowlist"
: "open";
const senderGroupPolicy = resolveSenderScopedGroupPolicy({
groupPolicy: params.groupPolicy,
groupAllowFrom: normalizedGroupAllowFrom,
});
const access = resolveDmGroupAccessWithLists({
isGroup: !params.isDirectMessage,
dmPolicy: params.dmPolicy,