diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServicePipelineViewResource.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServicePipelineViewResource.kt index 9f0a1cda35c7..13ac3deb1233 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServicePipelineViewResource.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServicePipelineViewResource.kt @@ -208,4 +208,14 @@ interface ServicePipelineViewResource { @PathParam("pipelineId") pipelineId: String ): Result> + + @Operation(summary = "根据视图ID获取流水线ID列表") + @POST + @Path("/pipelines/listPipelineIdByViewIds") + fun listPipelineIdByViewIds( + @PathParam("projectId") + projectId: String, + @Parameter(description = "按视图过滤", required = false) + viewIdsEncode: List + ): Result> } diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServicePipelineViewResourceImpl.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServicePipelineViewResourceImpl.kt index cf6add53457a..906d239d5058 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServicePipelineViewResourceImpl.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServicePipelineViewResourceImpl.kt @@ -208,4 +208,13 @@ class ServicePipelineViewResourceImpl @Autowired constructor( pipelineViewGroupService.listViewIdsByPipelineId(projectId, pipelineId) ) } + + override fun listPipelineIdByViewIds( + projectId: String, + viewIdsEncode: List + ): Result> { + return Result( + pipelineViewGroupService.listPipelineIdsByViewIds(projectId, viewIdsEncode) + ) + } } diff --git a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/impl/AbsProjectServiceImpl.kt b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/impl/AbsProjectServiceImpl.kt index 31bed594fb25..3877d4fa72eb 100644 --- a/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/impl/AbsProjectServiceImpl.kt +++ b/src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/impl/AbsProjectServiceImpl.kt @@ -59,6 +59,7 @@ import com.tencent.devops.common.auth.api.pojo.ProjectConditionDTO import com.tencent.devops.common.auth.api.pojo.ResourceRegisterInfo import com.tencent.devops.common.auth.api.pojo.SubjectScopeInfo import com.tencent.devops.common.auth.code.ProjectAuthServiceCode +import com.tencent.devops.common.auth.enums.SubjectScopeType import com.tencent.devops.common.client.Client import com.tencent.devops.common.client.ClientTokenService import com.tencent.devops.common.event.dispatcher.SampleEventDispatcher @@ -766,9 +767,27 @@ abstract class AbsProjectServiceImpl @Autowired constructor( beforeSubjectScopes: List, afterSubjectScopes: List ): Boolean { - val beforeIds = beforeSubjectScopes.map { it.id }.toSet() - val afterIds = afterSubjectScopes.map { it.id }.toSet() - return beforeIds != afterIds + val beforeUsernames = beforeSubjectScopes + .filter { it.type == SubjectScopeType.USER.value } + .map { it.username } + .toSet() + + val afterUsernames = afterSubjectScopes + .filter { it.type == SubjectScopeType.USER.value } + .map { it.username } + .toSet() + + val beforeDeptIds = beforeSubjectScopes + .filter { it.type != SubjectScopeType.USER.value } + .map { it.id } + .toSet() + + val afterDeptIds = afterSubjectScopes + .filter { it.type != SubjectScopeType.USER.value } + .map { it.id } + .toSet() + + return beforeUsernames != afterUsernames || beforeDeptIds != afterDeptIds } private fun updateApprovalInfo(