Skip to content

Commit

Permalink
Merge pull request TencentBlueKing#11131 from mingshewhe/feat_7443_auth
Browse files Browse the repository at this point in the history
feat: 引擎等MQ场景接入SCS框架 TencentBlueKing#7443
  • Loading branch information
bkci-bot authored Oct 25, 2024
2 parents 2106854 + e1611a5 commit 4cbdf6c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ package com.tencent.devops.auth.common

import com.tencent.devops.auth.filter.BlackListAspect
import com.tencent.devops.auth.refresh.dispatch.AuthRefreshDispatch
import com.tencent.devops.auth.refresh.event.RefreshBroadCastEvent
import com.tencent.devops.auth.refresh.event.ManagerOrganizationChangeEvent
import com.tencent.devops.auth.refresh.event.ManagerUserChangeEvent
import com.tencent.devops.auth.refresh.event.StrategyUpdateEvent
import com.tencent.devops.auth.refresh.listener.AuthRefreshEventListener
import com.tencent.devops.auth.service.AuthUserBlackListService
import com.tencent.devops.auth.service.UserPermissionService
import com.tencent.devops.common.event.annotation.EventConsumer
import com.tencent.devops.common.stream.ScsConsumerBuilder
import org.springframework.beans.factory.annotation.Autowired
Expand All @@ -46,17 +47,20 @@ class AuthCoreConfiguration {
@Bean
fun refreshDispatch(streamBridge: StreamBridge) = AuthRefreshDispatch(streamBridge)

@Bean
fun authRefreshEventListener(
@Autowired userPermissionService: UserPermissionService
) = AuthRefreshEventListener(
userPermissionService = userPermissionService
)
@EventConsumer(true)
fun managerChangeConsumer(
@Autowired refreshListener: AuthRefreshEventListener
) = ScsConsumerBuilder.build<ManagerOrganizationChangeEvent> { refreshListener.execute(it) }

@EventConsumer(true)
fun managerUserChangeConsumer(
@Autowired refreshListener: AuthRefreshEventListener
) = ScsConsumerBuilder.build<ManagerUserChangeEvent> { refreshListener.execute(it) }

@EventConsumer(true)
fun refreshBroadCastConsumer(
fun strategyUpdateConsumer(
@Autowired refreshListener: AuthRefreshEventListener
) = ScsConsumerBuilder.build<RefreshBroadCastEvent> { refreshListener.execute(it) }
) = ScsConsumerBuilder.build<StrategyUpdateEvent> { refreshListener.execute(it) }

@Bean
fun blackListAspect(authUserBlackListService: AuthUserBlackListService) = BlackListAspect(authUserBlackListService)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.tencent.devops.auth.entity.ManagerChangeType
import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.stream.constants.StreamBinding

@Event(destination = StreamBinding.AUTH_REFRESH_FANOUT)
@Event(destination = StreamBinding.AUTH_MANGER_CHANGE_FANOUT)
data class ManagerOrganizationChangeEvent(
override val refreshType: String,
override var retryCount: Int = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.tencent.devops.auth.entity.UserChangeType
import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.stream.constants.StreamBinding

@Event(destination = StreamBinding.AUTH_REFRESH_FANOUT)
@Event(destination = StreamBinding.AUTH_MANGER_USER_CHANGE_FANOUT)
data class ManagerUserChangeEvent(
override val refreshType: String,
val userChangeType: UserChangeType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@

package com.tencent.devops.auth.refresh.event

import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.event.pojo.IEvent
import com.tencent.devops.common.service.trace.TraceTag
import com.tencent.devops.common.stream.constants.StreamBinding
import org.slf4j.MDC

@Event(StreamBinding.AUTH_REFRESH_FANOUT)
open class RefreshBroadCastEvent(
open val refreshType: String,
open var retryCount: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.tencent.devops.auth.entity.StrategyChangeType
import com.tencent.devops.common.event.annotation.Event
import com.tencent.devops.common.stream.constants.StreamBinding

@Event(destination = StreamBinding.AUTH_REFRESH_FANOUT)
@Event(destination = StreamBinding.AUTH_STRATEGY_UPDATE_FANOUT)
data class StrategyUpdateEvent(
override val refreshType: String,
override var retryCount: Int = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ object StreamBinding {
const val GIT_WEBHOOK_UNLOCK_EVENT = "webhook.unlock.event"

// 蓝盾管理员
const val AUTH_REFRESH_FANOUT = "auth.refresh.exchange.fanout"
const val AUTH_MANGER_CHANGE_FANOUT = "auth.manager.change.fanout"
const val AUTH_MANGER_USER_CHANGE_FANOUT = "auth.manager.user.change.fanout"
const val AUTH_STRATEGY_UPDATE_FANOUT = "auth.strategy.update.fanout"

// 流水线webhook commit记录
const val PIPELINE_BUILD_COMMIT_FINISH_FANOUT = "engine.pipeline.build.commits.finish.fanout"
Expand Down Expand Up @@ -204,4 +206,4 @@ object StreamBinding {
const val PIPELINE_YAML_LISTENER_ENABLE = "pipeline.yaml.listener.enable"
const val PIPELINE_YAML_LISTENER_DISABLE = "pipeline.yaml.listener.disable"
const val PIPELINE_YAML_LISTENER_TRIGGER = "pipeline.yaml.listener.trigger"
}
}

0 comments on commit 4cbdf6c

Please sign in to comment.