From 45d53953646ef4696332d4397d74b07921e5b411 Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Thu, 1 Feb 2024 16:17:52 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20Job=20=E6=94=AF=E6=8C=81=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E6=89=A7=E8=A1=8C=20-=20=E8=84=9A=E6=9C=AC=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=20#2631?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/impl/ExecuteAuthServiceImpl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/auth/impl/ExecuteAuthServiceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/auth/impl/ExecuteAuthServiceImpl.java index 448e5466c5..1368709a12 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/auth/impl/ExecuteAuthServiceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/auth/impl/ExecuteAuthServiceImpl.java @@ -450,6 +450,20 @@ private List convertDynamicGroupsToPermissionResourceList(Ap return hostResources; } + private List convertContainersToPermissionResourceList(AppResourceScope appResourceScope) { + List hostResources = new ArrayList<>(); + PermissionResource resource = new PermissionResource(); + resource.setResourceId(appResourceScope.getId()); + resource.setResourceType(ResourceTypeEnum.HOST); + resource.setSubResourceType("container"); + resource.setResourceName(getResourceName(appResourceScope)); + resource.setSystemId(SystemId.CMDB); + resource.setType(CcNodeTypeEnum.BIZ.getType()); + resource.setParentHierarchicalResources(null); + hostResources.add(resource); + return hostResources; + } + private List convertHostsToPermissionResourceList(AppResourceScope appResourceScope, ExecuteObjectsDTO servers) { List hostResources = new ArrayList<>(); @@ -475,6 +489,10 @@ private List convertHostsToPermissionResourceList(AppResourc if (!CollectionUtils.isEmpty(servers.getDynamicServerGroups())) { hostResources.addAll(convertDynamicGroupsToPermissionResourceList(appResourceScope, servers)); } + // 静态容器 + if (!CollectionUtils.isEmpty(servers.getStaticContainerList())) { + hostResources.addAll(convertContainersToPermissionResourceList(appResourceScope)); + } return hostResources; }