query.py 490 B

123456789101112131415
  1. """查询参数中的 tenant_id:仅平台超管可使用,其余调用方应剥离。"""
  2. from app.api.v1.module_system.auth.schema import AuthSchema
  3. def search_dict_respecting_tenant_filter(auth: AuthSchema, search_dict: dict | None) -> dict:
  4. """
  5. 从查询字典中构造 CRUD 使用的 search。
  6. 非平台超管传入的 tenant_id 会被忽略,避免越权按租户筛选。
  7. """
  8. if not search_dict:
  9. return {}
  10. out = dict(search_dict)
  11. return out