feat(pl): 运输计划模块接入数据权限过滤
新增 pl_data_scope 辅助,PL 列表/统计 apply_pl_scope,详情与改删 assert_pl_row_in_scope;运费结算待办审批 skip_scope。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bf73b6b2d8
commit
eff99edeea
8 files changed
+526
-53
No files matched your search
@@ -0,0 +1,27 @@
|
||||
"""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)
|
||||
Reference in new issue
Block a user