"""PL 模块数据权限辅助(create_by / create_dept_id,无 owner_field)。""" from __future__ import annotations from typing import TYPE_CHECKING from sqlalchemy.orm import Session from app.core.data_scope import apply_data_scope, assert_row_in_data_scope if TYPE_CHECKING: from app.core.db_auth import DbUserContext def apply_pl_scope(query, model, user: "DbUserContext", db: Session, tenant_no: str): """列表查询应用数据权限。""" return apply_data_scope(query, model, user.to_user_info(), db, tenant_no) def assert_pl_row_in_scope( db: Session, row, model, user: "DbUserContext", tenant_no: str, ) -> None: """详情/改/删前校验行级数据权限。""" assert_row_in_data_scope(db, row, model, user.to_user_info(), tenant_no)