18 lines
514 B
JavaScript
18 lines
514 B
JavaScript
|
|
import {
|
||
|
|
isIntentAllowedByWechatCursorPolicy,
|
||
|
|
isUserAllowedByWechatCursorPolicy,
|
||
|
|
} from './wechat-cursor-executor-admin-config.mjs';
|
||
|
|
|
||
|
|
export function resolveWechatCursorExecutorEligible({
|
||
|
|
user = null,
|
||
|
|
userId = null,
|
||
|
|
intentKind = '',
|
||
|
|
policy = null,
|
||
|
|
} = {}) {
|
||
|
|
if (!policy?.enabled) return false;
|
||
|
|
const subject = user ?? { userId };
|
||
|
|
if (!isUserAllowedByWechatCursorPolicy(subject, policy)) return false;
|
||
|
|
if (!isIntentAllowedByWechatCursorPolicy(intentKind, policy)) return false;
|
||
|
|
return true;
|
||
|
|
}
|