Skip to content

Commit

Permalink
bugfix: 修复非超管查询全部业务历史任务报错(fixed #1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
neko12583 authored and ZhuoZhuoCrayon committed Aug 15, 2023
1 parent 51b0e26 commit 29f30e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/node_man/handlers/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ def list(self, params: dict, username: str):
all_biz_info = CmdbHandler().biz_id_name_without_permission()
biz_info = CmdbHandler().biz_id_name({"action": constants.IamActionType.task_history_view})
biz_permission = list(biz_info.keys())
if not biz_permission:
return {"total": 0, "list": []}

if params.get("job_id"):
job_ids = set()
Expand All @@ -181,12 +179,16 @@ def list(self, params: dict, username: str):
else:
biz_scope = biz_permission

if not biz_scope:
return {"total": 0, "list": []}

if set(biz_scope) & all_biz_ids == all_biz_ids:
# 查询全部业务且拥有全部业务权限
biz_scope_query_q = Q()
else:
biz_scope_query_q = reduce(
operator.or_,
[Q(bk_biz_scope__contains=bk_biz_id) for bk_biz_id in search_biz_ids],
[Q(bk_biz_scope__contains=bk_biz_id) for bk_biz_id in biz_scope],
Q()
)
# 仅查询所有业务时,自身创建的 job 可见
Expand Down

0 comments on commit 29f30e9

Please sign in to comment.