fix: 借库审批同样修复 — sys_element 补充 op_borrow_approval:operation,can_approve 增加 RBAC 权限判断
This commit is contained in:
@ -296,6 +296,16 @@ class BorrowApprovalService:
|
|||||||
if user_role and user_role.upper() == 'SUPER_ADMIN':
|
if user_role and user_role.upper() == 'SUPER_ADMIN':
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# 拥有 op_borrow_approval:operation 权限的用户可以审批任意借库单
|
||||||
|
# (前端按钮以此权限控制显示,后端也必须对齐)
|
||||||
|
from app.models.system import SysRolePermission
|
||||||
|
has_op = SysRolePermission.query.filter(
|
||||||
|
SysRolePermission.role_code == user_role,
|
||||||
|
SysRolePermission.target_code.in_(['op_borrow_approval:operation', 'op_borrow_approval:*'])
|
||||||
|
).first() is not None
|
||||||
|
if has_op:
|
||||||
|
return True
|
||||||
|
|
||||||
for approver in approvers:
|
for approver in approvers:
|
||||||
approver_type = approver.get('type', '')
|
approver_type = approver.get('type', '')
|
||||||
approver_value = approver.get('value', '')
|
approver_value = approver.get('value', '')
|
||||||
|
|||||||
Reference in New Issue
Block a user