forked from TencentBlueKing/bk-turbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Turbo编译加速对接权限中心RBAC TencentBlueKing#316
- Loading branch information
Showing
23 changed files
with
605 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/backend/turbo/common-turbo/common-turbo-api/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...common-turbo-api/src/main/kotlin/com/tencent/devops/common/api/annotation/RequiresAuth.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.tencent.devops.common.api.annotation | ||
|
||
import com.tencent.devops.common.util.enums.ResourceActionType | ||
import com.tencent.devops.common.util.enums.ResourceType | ||
|
||
@MustBeDocumented | ||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
annotation class RequiresAuth( | ||
/** | ||
* 资源类型 选填,默认加速方案 | ||
*/ | ||
val resourceType: ResourceType = ResourceType.TURBO_PLAN, | ||
|
||
/** | ||
* 对资源的操作权限id 选填,默认查看方案权限 | ||
*/ | ||
val permission: ResourceActionType = ResourceActionType.VIEW | ||
) |
9 changes: 9 additions & 0 deletions
9
src/backend/turbo/common-turbo/common-turbo-auth/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencies { | ||
api(project(":common-turbo:common-turbo-client")) | ||
api("com.tencent.bk.devops.ci.auth:api-auth:${Versions.ciVersion}") { | ||
isTransitive = false | ||
} | ||
api("com.tencent.bk.devops.ci.common:common-auth-api:${Versions.ciVersion}"){ | ||
isTransitive = false | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...on-turbo-auth/src/main/kotlin/com/tencent/devops/common/auth/RBACAuthAutoConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.tencent.devops.common.auth | ||
|
||
import com.tencent.devops.common.auth.api.RBACAuthProperties | ||
import com.tencent.devops.common.auth.api.external.RBACAuthPermissionApi | ||
import com.tencent.devops.common.auth.api.RBACAuthRegisterApi | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import com.tencent.devops.common.client.Client | ||
|
||
@Configuration | ||
class RBACAuthAutoConfiguration { | ||
|
||
@Bean | ||
fun rbacAuthProperties() = RBACAuthProperties() | ||
|
||
@Bean | ||
fun rbacAuthPermissionApi( | ||
rbacAuthProperties: RBACAuthProperties, | ||
client: Client | ||
) = RBACAuthPermissionApi(client, rbacAuthProperties) | ||
|
||
@Bean | ||
fun rbacAuthRegisterApi( | ||
rbacAuthProperties: RBACAuthProperties, | ||
client: Client | ||
) = RBACAuthRegisterApi(client, rbacAuthProperties) | ||
} |
Oops, something went wrong.