Skip to content

Commit

Permalink
Merge pull request #11384 from fcfang123/issue-11383
Browse files Browse the repository at this point in the history
feat:新增service接口用于获取流水线组下流水线 #11383
  • Loading branch information
mingshewhe authored Jan 8, 2025
2 parents 6060bbd + 84e6cf8 commit d3a9e31
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,14 @@ interface ServicePipelineViewResource {
@PathParam("pipelineId")
pipelineId: String
): Result<Set<Long>>

@Operation(summary = "根据视图ID获取流水线ID列表")
@POST
@Path("/pipelines/listPipelineIdByViewIds")
fun listPipelineIdByViewIds(
@PathParam("projectId")
projectId: String,
@Parameter(description = "按视图过滤", required = false)
viewIdsEncode: List<String>
): Result<List<String>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,13 @@ class ServicePipelineViewResourceImpl @Autowired constructor(
pipelineViewGroupService.listViewIdsByPipelineId(projectId, pipelineId)
)
}

override fun listPipelineIdByViewIds(
projectId: String,
viewIdsEncode: List<String>
): Result<List<String>> {
return Result(
pipelineViewGroupService.listPipelineIdsByViewIds(projectId, viewIdsEncode)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -766,9 +767,27 @@ abstract class AbsProjectServiceImpl @Autowired constructor(
beforeSubjectScopes: List<SubjectScopeInfo>,
afterSubjectScopes: List<SubjectScopeInfo>
): 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(
Expand Down

0 comments on commit d3a9e31

Please sign in to comment.