feat(tenant): 按租户隔离用户身份与后台权限
This commit is contained in:
@@ -69,7 +69,6 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
var tenantRepo *tenancy.Repository
|
||||
if deps.DB != nil {
|
||||
tenantRepo = tenancy.NewRepository(deps.DB)
|
||||
engine.Use(middleware.TenantContext(tenantRepo, cfg.AppEnv, logger))
|
||||
}
|
||||
tenantHandler := tenancy.NewHandler()
|
||||
jwtManager := auth.NewJWTManager(cfg.JWTSecret)
|
||||
@@ -356,6 +355,9 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
if distributionRepo != nil {
|
||||
engine.Use(middleware.SiteDomainFallback(distributionRepo, logger))
|
||||
}
|
||||
if tenantRepo != nil {
|
||||
engine.Use(middleware.TenantContext(tenantRepo, cfg.AppEnv, logger, "dachui"))
|
||||
}
|
||||
distributionHandler := distribution.NewHandler(distributionService)
|
||||
if invitationHandler != nil && distributionService != nil {
|
||||
invitationHandler.SetSiteScoper(distributionService)
|
||||
|
||||
Reference in New Issue
Block a user