Files
zlwuandCursor eff99edeea feat(pl): 运输计划模块接入数据权限过滤
新增 pl_data_scope 辅助,PL 列表/统计 apply_pl_scope,详情与改删 assert_pl_row_in_scope;运费结算待办审批 skip_scope。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 21:00:15 +08:00

28 lines
801 B
Python

"""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)