From 810304a51db84a24fe9ebf5c9f0abc074f8276ec Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sun, 27 Dec 2020 16:56:31 +0800 Subject: [PATCH 1/2] Tenant administrators subscribe before publishing new tenant events --- .../Distributed/TenantCreateEventHandler.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs index ec1fa8927..283b40f2f 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/EventBus/Distributed/TenantCreateEventHandler.cs @@ -21,11 +21,13 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed protected ISettingProvider SettingProvider { get; } protected IStringLocalizer StringLocalizer { get; } protected INotificationSender NotificationSender { get; } + protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } public TenantCreateEventHandler( ICurrentTenant currentTenant, ISettingProvider settingProvider, INotificationSender notificationSender, + INotificationSubscriptionManager notificationSubscriptionManager, IStringLocalizer stringLocalizer, ILogger logger) { @@ -34,10 +36,20 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed SettingProvider = settingProvider; StringLocalizer = stringLocalizer; NotificationSender = notificationSender; + NotificationSubscriptionManager = notificationSubscriptionManager; } public async Task HandleEventAsync(CreateEventData eventData) { + var tenantAdminUserIdentifier = new UserIdentifier(eventData.AdminUserId, eventData.AdminEmailAddress); + + // 租户管理员订阅事件 + await NotificationSubscriptionManager + .SubscribeAsync( + eventData.Id, + tenantAdminUserIdentifier, + TenantNotificationNames.NewTenantRegistered); + var userDefaultCultureName = await SettingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); if (userDefaultCultureName.IsNullOrWhiteSpace()) { @@ -46,8 +58,6 @@ namespace LINGYUN.Abp.MessageService.EventBus.Distributed // 使用系统区域语言发布通知 using (CultureHelper.Use(userDefaultCultureName, userDefaultCultureName)) { - var tenantAdminUserIdentifier = new UserIdentifier(eventData.AdminUserId, eventData.AdminEmailAddress); - var notificationData = new NotificationData(); notificationData.WriteStandardData( L("NewTenantRegisteredNotificationTitle"), From c129d445a249d4e02d48bd2d4ea150109b2017dc Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Fri, 22 Jan 2021 11:57:53 +0800 Subject: [PATCH 2/2] Removes client permission fixes that are no longer needed --- .../LINGYUN.Abp.EventBus.CAP.xml | 13 +------- .../FixClientPermissionValueProvider.cs | 30 ------------------- 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain/LINGYUN/Abp/PermissionManagement/FixClientPermissionValueProvider.cs diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml index ef9cf30d9..e8a019a89 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml +++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml @@ -9,11 +9,6 @@ 消费者查找器 - - - Abp Cap事件配置 - - Abp分布式事件配置 @@ -24,7 +19,7 @@ 服务提供者 - + Creates a new . @@ -137,12 +132,6 @@ default: false - - - 事件名称定义在事件参数类型 - default: true - - 批量清理数量 diff --git a/aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain/LINGYUN/Abp/PermissionManagement/FixClientPermissionValueProvider.cs b/aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain/LINGYUN/Abp/PermissionManagement/FixClientPermissionValueProvider.cs deleted file mode 100644 index 4dd827220..000000000 --- a/aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain/LINGYUN/Abp/PermissionManagement/FixClientPermissionValueProvider.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Threading.Tasks; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.DependencyInjection; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Abp.PermissionManagement -{ - // fix: https://github.com/abpframework/abp/issues/6022 - // TODO: 在4.0正式版中已修复此问题,升级后需要移除 - [Dependency(ReplaceServices = true)] - [ExposeServices(typeof(ClientPermissionValueProvider))] - public class FixClientPermissionValueProvider : ClientPermissionValueProvider - { - protected ICurrentTenant CurrentTenant { get; } - public FixClientPermissionValueProvider( - IPermissionStore permissionStore, - ICurrentTenant currentTenant) : base(permissionStore, currentTenant) - { - CurrentTenant = currentTenant; - } - - public override async Task CheckAsync(PermissionValueCheckContext context) - { - using (CurrentTenant.Change(null)) - { - return await base.CheckAsync(context); - } - } - } -}