File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments