pbl_domain_ext/wwwroot/api/pbl_domain_ref_check_access.dspy
2026-09-18 12:12:52 +08:00

25 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# api/pbl_domain_ref_check_access.dspy — 契约端点check_ref_access设计 §3.2 接口 10
# 实现pbl_domain_ext/api.py:check_ref_accessenv.pbl_check_ref_access
# 出参bool租户+班级+团队三重匹配;不抛异常,供运行时热路径判定 F-RT-02
debug('pbl_domain_ref_check_access.dspy: START params_kw=%s' % dict(params_kw))
try:
_allowed = await pbl_check_ref_access(
params_kw.get('ref_type'),
params_kw.get('ref_id'),
params_kw.get('tenant_id'),
class_id=params_kw.get('class_id'),
team_id=params_kw.get('team_id'),
)
debug('pbl_domain_ref_check_access.dspy: OK allowed=%s' % _allowed)
return {'success': True, 'error_code': None, 'message': 'ok',
'data': {'allowed': bool(_allowed)},
'allowed': bool(_allowed),
'http_status': 200 if _allowed else 403}
except Exception as exc:
_code = getattr(exc, 'code', None) or 'PBL_E_INTERNAL'
_msg = getattr(exc, 'message', None) or str(exc)
debug('pbl_domain_ref_check_access.dspy: FAIL code=%s msg=%s' % (_code, _msg))
return {'success': False, 'error_code': _code, 'message': _msg,
'data': {'allowed': False}, 'allowed': False, 'http_status': 500}