feat(bx): 报销模块接入数据权限过滤

新增 bx_data_scope 与 BxUserContext.to_user_info,列表/我的单据 AND scope,待办审批不加 scope,审批操作 skip_scope。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-06-28 21:00:18 +08:00
1 parent eff99edeea
commit 2905dc3d5f
14 files changed
+351 -123

No files matched your search

+4 -4
View File
@@ -26,7 +26,7 @@ def list_workflows(
user: BxUserContext = Depends(get_bx_current_user),
):
tenant_no = get_tenant_no(db, user.to_tenant_user_dict())
rows, total = WorkflowService.get_paged(db, tenant_no, page=page, page_size=pageSize)
rows, total = WorkflowService.get_paged(db, tenant_no, page=page, page_size=pageSize, user=user)
out_rows = [WorkflowDefOut.model_validate(r) for r in rows]
paged_data = PagedData(rows=out_rows, total=total, page=page, page_size=pageSize)
return ApiResponse(data=paged_data)
@@ -51,7 +51,7 @@ def get_workflow(
user: BxUserContext = Depends(get_bx_current_user),
):
tenant_no = get_tenant_no(db, user.to_tenant_user_dict())
workflow = WorkflowService.get_by_id(db, workflow_id, tenant_no)
workflow = WorkflowService.get_by_id(db, workflow_id, tenant_no, user=user)
if not workflow:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="工作流不存在")
return ApiResponse(data=WorkflowDefOut.model_validate(workflow))
@@ -107,7 +107,7 @@ def save_workflow_nodes(
except ValueError as exc:
db.rollback()
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
workflow = WorkflowService.get_by_id(db, workflow_id, tenant_no)
workflow = WorkflowService.get_by_id(db, workflow_id, tenant_no, user=user)
if not workflow:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="工作流不存在")
db.commit()
@@ -122,7 +122,7 @@ def delete_workflow(
user: BxUserContext = Depends(get_bx_current_user),
):
tenant_no = get_tenant_no(db, user.to_tenant_user_dict())
workflow = WorkflowService.get_by_id(db, workflow_id, tenant_no)
workflow = WorkflowService.get_by_id(db, workflow_id, tenant_no, user=user)
if not workflow:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="工作流不存在")
WorkflowService.soft_delete(db, workflow_id, user=user)