Skip to content

Commit 05fe02f

Browse files
committed
update dept arg
1 parent e78b53e commit 05fe02f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

backend/common/security/permission.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def filter_data_permission(request: Request, model: Any) -> Any:
5454
if not user_roles:
5555
return or_(getattr(model, 'created_by') == user_id if hasattr(model, 'created_by') else 1 == 0)
5656

57-
dept_id = user.dept_id
57+
user_dept_id = user.dept_id
5858

5959
conditions = []
6060

@@ -74,12 +74,12 @@ def filter_data_permission(request: Request, model: Any) -> Any:
7474

7575
# 部门及以下数据权限
7676
elif role.data_scope == 2:
77-
child_dept_ids = select(Dept.id).where(or_(Dept.id == dept_id, Dept.parent_id == dept_id))
77+
child_dept_ids = select(Dept.id).where(or_(Dept.id == user_dept_id, Dept.parent_id == user_dept_id))
7878
conditions.append(getattr(model, 'dept_id').in_(child_dept_ids) if hasattr(model, 'dept_id') else 1 == 0)
7979

8080
# 本部门数据权限
8181
elif role.data_scope == 3:
82-
conditions.append(getattr(model, 'dept_id') == dept_id if hasattr(model, 'dept_id') else 1 == 0)
82+
conditions.append(getattr(model, 'dept_id') == user_dept_id if hasattr(model, 'dept_id') else 1 == 0)
8383

8484
# 仅本人数据权限
8585
elif role.data_scope == 4:

0 commit comments

Comments
 (0)