Browse Source

TaskGroup remove query func permission check. (#10557)

3.1.0-release
WangJPLeo 2 years ago committed by GitHub
parent
commit
bc4ceda4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java
  2. 2
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java
  3. 9
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.xml

11
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<String, Object> queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) { public Map<String, Object> queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Page<TaskGroup> page = new Page<>(pageNo, pageSize); Page<TaskGroup> page = new Page<>(pageNo, pageSize);
PageInfo<TaskGroup> emptyPageInfo = new PageInfo<>(pageNo, pageSize);
boolean canOperatorPermissions = canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP, ApiFuncIdentificationConstant.TASK_GROUP_VIEW); Set<Integer> ids = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.TASK_GROUP, loginUser.getId(), logger);
if (!canOperatorPermissions){ if (ids.isEmpty()) {
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION); result.put(Constants.DATA_LIST, emptyPageInfo);
putMsg(result, Status.SUCCESS);
return result; return result;
} }
IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPagingByProjectCode(page, projectCode); IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPagingByProjectCode(page, new ArrayList<>(ids), projectCode);
return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging); return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging);
} }

2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.java

@ -78,7 +78,7 @@ public interface TaskGroupMapper extends BaseMapper<TaskGroup> {
int selectCountByIdStatus(@Param("id") int id,@Param("status") int status); int selectCountByIdStatus(@Param("id") int id,@Param("status") int status);
IPage<TaskGroup> queryTaskGroupPagingByProjectCode(Page<TaskGroup> page, @Param("projectCode") Long projectCode); IPage<TaskGroup> queryTaskGroupPagingByProjectCode(Page<TaskGroup> page, @Param("ids") List<Integer> ids, @Param("projectCode") Long projectCode);
/** /**
* listAuthorizedResource * listAuthorizedResource

9
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupMapper.xml

@ -62,7 +62,14 @@
<include refid="baseSql"> <include refid="baseSql">
</include> </include>
from t_ds_task_group from t_ds_task_group
where project_code in ( #{projectCode} , 0) where 1=1
<if test="ids != null and ids.size() > 0">
and id in
<foreach collection="ids" item="i" open="(" close=")" separator=",">
#{i}
</foreach>
</if>
and project_code in ( #{projectCode} , 0)
order by update_time desc order by update_time desc
</select> </select>

Loading…
Cancel
Save