Skip to content

Commit

Permalink
Merge pull request #11190 from fcfang123/issue-10895
Browse files Browse the repository at this point in the history
feat:流水线列表展示权限控制 #10895
  • Loading branch information
bkci-bot authored Nov 5, 2024
2 parents c8fe512 + 0eb03e0 commit a55e150
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -109,7 +110,8 @@ class PipelinePermConfiguration {
pipelineInfoDao: PipelineInfoDao,
pipelineViewGroupCommonService: PipelineViewGroupCommonService,
authResourceApi: AuthResourceApi,
client: Client
client: Client,
projectCacheService: ProjectCacheService
): PipelinePermissionService = RbacPipelinePermissionService(
authPermissionApi = authPermissionApi,
authProjectApi = authProjectApi,
Expand All @@ -118,6 +120,7 @@ class PipelinePermConfiguration {
pipelineInfoDao = pipelineInfoDao,
pipelineViewGroupCommonService = pipelineViewGroupCommonService,
authResourceApi = authResourceApi,
client = client
client = client,
projectCacheService = projectCacheService
)
}

0 comments on commit a55e150

Please sign in to comment.