Skip to content

Commit

Permalink
Merge pull request #10712 from yongyiduan/issue_10711
Browse files Browse the repository at this point in the history
[stream]新增获取组成员 #10711
  • Loading branch information
bkci-bot authored Aug 2, 2024
2 parents e840d33 + 5f770ff commit 983284e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ package com.tencent.devops.auth.provider.stream.service

import com.tencent.devops.auth.utils.GitTypeUtils
import com.tencent.devops.common.auth.api.AuthPermission
import com.tencent.devops.common.auth.api.pojo.BkAuthGroup
import com.tencent.devops.common.client.Client
import org.springframework.beans.factory.annotation.Autowired

class CentralizedStramPermissionServiceImpl @Autowired constructor(
val client: Client
) : StreamPermissionServiceImpl() {
override fun getProjectUsers(projectCode: String, group: BkAuthGroup?): List<String> {
return emptyList()
}

override fun isPublicProject(projectCode: String, userId: String?): Boolean {
val gitType = GitTypeUtils.getType()
// type: github, gitlab, svn, tgitd等
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ package com.tencent.devops.auth.provider.stream.service

import com.google.common.cache.CacheBuilder
import com.tencent.devops.common.auth.api.AuthPermission
import com.tencent.devops.common.auth.api.pojo.BkAuthGroup
import com.tencent.devops.common.client.Client
import com.tencent.devops.repository.api.github.ServiceGithubPermissionResource
import com.tencent.devops.stream.api.service.ServiceStreamBasicSettingResource
Expand Down Expand Up @@ -64,6 +65,10 @@ class GithubStreamPermissionServiceImpl @Autowired constructor(
.expireAfterAccess(5, TimeUnit.MINUTES)
.build<String, Boolean?>()

override fun getProjectUsers(projectCode: String, group: BkAuthGroup?): List<String> {
return emptyList()
}

override fun isPublicProject(projectCode: String, userId: String?): Boolean {
if (publicProjectCache.getIfPresent(projectCode) != null) {
return publicProjectCache.getIfPresent(projectCode)!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@
package com.tencent.devops.auth.provider.stream.service

import com.tencent.devops.common.auth.api.AuthPermission
import com.tencent.devops.common.auth.api.pojo.BkAuthGroup
import org.springframework.beans.factory.annotation.Autowired

class GitlabStreamPermissionServiceImpl @Autowired constructor() : StreamPermissionServiceImpl() {
override fun getProjectUsers(projectCode: String, group: BkAuthGroup?): List<String> {
return emptyList()
}

override fun isPublicProject(projectCode: String, userId: String?): Boolean {
TODO("Not yet implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class StreamPermissionProjectServiceImpl @Autowired constructor(
private val streamPermissionService: StreamPermissionServiceImpl
) : PermissionProjectService {
override fun getProjectUsers(projectCode: String, group: BkAuthGroup?): List<String> {
// stream场景下使用不到此接口。占做默认实现
return emptyList()
return streamPermissionService.getProjectUsers(projectCode, group)
}

override fun getProjectGroupAndUserList(projectCode: String): List<BkAuthGroupAndUserList> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ package com.tencent.devops.auth.provider.stream.service
import com.tencent.devops.auth.service.iam.PermissionService
import com.tencent.devops.common.auth.api.AuthPermission
import com.tencent.devops.common.auth.api.pojo.AuthResourceInstance
import com.tencent.devops.common.auth.api.pojo.BkAuthGroup
import com.tencent.devops.common.auth.utils.ActionTypeUtils
import org.slf4j.LoggerFactory

Expand Down Expand Up @@ -191,6 +192,8 @@ abstract class StreamPermissionServiceImpl : PermissionService {
return emptyMap()
}

abstract fun getProjectUsers(projectCode: String, group: BkAuthGroup?): List<String>

/**
* 是否是开源项目
* projectCode: stream侧项目编码
Expand Down

0 comments on commit 983284e

Please sign in to comment.