diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/RbacPipelinePermissionService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/RbacPipelinePermissionService.kt index 2c6d78df27af..e841cecf1f05 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/RbacPipelinePermissionService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/RbacPipelinePermissionService.kt @@ -39,11 +39,10 @@ import com.tencent.devops.common.auth.api.pojo.BkAuthGroup import com.tencent.devops.common.auth.code.PipelineAuthServiceCode import com.tencent.devops.common.client.Client import com.tencent.devops.process.engine.dao.PipelineInfoDao +import com.tencent.devops.process.service.ProjectCacheService import com.tencent.devops.process.service.view.PipelineViewGroupCommonService -import com.tencent.devops.project.api.service.ServiceProjectResource import org.jooq.DSLContext import org.slf4j.LoggerFactory -import javax.ws.rs.NotFoundException @Suppress("LongParameterList") class RbacPipelinePermissionService( @@ -54,7 +53,8 @@ class RbacPipelinePermissionService( val pipelineInfoDao: PipelineInfoDao, val pipelineViewGroupCommonService: PipelineViewGroupCommonService, val authResourceApi: AuthResourceApi, - val client: Client + val client: Client, + val projectCacheService: ProjectCacheService ) : PipelinePermissionService { override fun checkPipelinePermission( @@ -301,8 +301,7 @@ class RbacPipelinePermissionService( } override fun isControlPipelineListPermission(projectId: String): Boolean { - val projectInfo = client.get(ServiceProjectResource::class).get(englishName = projectId).data - ?: throw NotFoundException("Fail to find the project info of project($projectId)") + val projectInfo = projectCacheService.getProject(projectId) ?: return false return projectInfo.properties?.pipelineListPermissionControl == true } diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/config/PipelinePermConfiguration.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/config/PipelinePermConfiguration.kt index 92460f6d6c65..d63bf4f37d0e 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/config/PipelinePermConfiguration.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/permission/config/PipelinePermConfiguration.kt @@ -38,6 +38,7 @@ import com.tencent.devops.process.permission.MockPipelinePermissionService import com.tencent.devops.process.permission.PipelinePermissionService import com.tencent.devops.process.permission.RbacPipelinePermissionService import com.tencent.devops.process.permission.StreamPipelinePermissionServiceImpl +import com.tencent.devops.process.service.ProjectCacheService import com.tencent.devops.process.service.view.PipelineViewGroupCommonService import org.jooq.DSLContext import org.springframework.boot.autoconfigure.AutoConfigureOrder @@ -109,7 +110,8 @@ class PipelinePermConfiguration { pipelineInfoDao: PipelineInfoDao, pipelineViewGroupCommonService: PipelineViewGroupCommonService, authResourceApi: AuthResourceApi, - client: Client + client: Client, + projectCacheService: ProjectCacheService ): PipelinePermissionService = RbacPipelinePermissionService( authPermissionApi = authPermissionApi, authProjectApi = authProjectApi, @@ -118,6 +120,7 @@ class PipelinePermConfiguration { pipelineInfoDao = pipelineInfoDao, pipelineViewGroupCommonService = pipelineViewGroupCommonService, authResourceApi = authResourceApi, - client = client + client = client, + projectCacheService = projectCacheService ) }