From bc4ceda4cf864d068583879ae8f35afdaaefeccb Mon Sep 17 00:00:00 2001 From: WangJPLeo <103574007+WangJPLeo@users.noreply.github.com> Date: Thu, 23 Jun 2022 10:00:31 +0800 Subject: [PATCH] TaskGroup remove query func permission check. (#10557) --- .../api/service/impl/TaskGroupServiceImpl.java | 11 ++++++----- .../dolphinscheduler/dao/mapper/TaskGroupMapper.java | 2 +- .../dolphinscheduler/dao/mapper/TaskGroupMapper.xml | 9 ++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java index 5941196ed1..32ea9ad39f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java @@ -215,13 +215,14 @@ public class TaskGroupServiceImpl extends BaseServiceImpl implements TaskGroupSe public Map queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) { Map result = new HashMap<>(); Page page = new Page<>(pageNo, pageSize); - - boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_VIEW); - if (!canOperatorPermissions){ - putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION); + PageInfo emptyPageInfo = new PageInfo<>(pageNo, pageSize); + Set ids = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.TASK_GROUP, loginUser.getId(), logger); + if (ids.isEmpty()) { + result.put(Constants.DATA_LIST, emptyPageInfo); + putMsg(result, Status.SUCCESS); return result; } - IPage taskGroupPaging = taskGroupMapper.queryTaskGroupPagingByProjectCode(page, projectCode); + IPage taskGroupPaging = taskGroupMapper.queryTaskGroupPagingByProjectCode(page, new ArrayList<>(ids), projectCode); return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging); } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java index 48b9fb6c22..a2c9359e18 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java @@ -78,7 +78,7 @@ public interface TaskGroupMapper extends BaseMapper { int selectCountByIdStatus(@Param("id") int id,@Param("status") int status); - IPage queryTaskGroupPagingByProjectCode(Page page, @Param("projectCode") Long projectCode); + IPage queryTaskGroupPagingByProjectCode(Page page, @Param("ids") List ids, @Param("projectCode") Long projectCode); /** * listAuthorizedResource diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.xml index 54e4c63341..7d3fa96b11 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.xml @@ -62,7 +62,14 @@ from t_ds_task_group - where project_code in ( #{projectCode} , 0) + where 1=1 + + and id in + + #{i} + + + and project_code in ( #{projectCode} , 0) order by update_time desc