From d4e949b7202d0be5203ccf6cc0458da92d06760e Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 9 Oct 2024 15:04:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(data-protection):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=8C=96=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...YUN.Abp.DataProtection.Abstractions.csproj | 11 ++++++++ .../AbpDataProtectionAbstractionsModule.cs | 20 +++++++++++++- .../Localization/Resources/en.json | 6 +++++ .../Localization/Resources/zh-Hans.json | 6 +++++ .../Reflection/NullableTypeExtensions.cs | 4 +-- ...tectionManagementApplicationServiceBase.cs | 5 ++-- ...aProtectionManagement.Domain.Shared.csproj | 10 +++++++ ...aProtectionManagementDomainSharedModule.cs | 26 ++++++++++++++++++- .../Localization/Resources/en.json | 9 +++++++ .../Localization/Resources/zh-Hans.json | 9 +++++++ 10 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json create mode 100644 aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json create mode 100644 aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/en.json create mode 100644 aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/zh-Hans.json diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj index 6370f425a..1a4ba4ee6 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj @@ -13,8 +13,19 @@ + + + + + + + + + + + diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs index dad08b9da..e698f6b06 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs @@ -1,9 +1,27 @@ -using Volo.Abp.Modularity; +using LINGYUN.Abp.DataProtection.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.DataProtection; +[DependsOn(typeof(AbpLocalizationModule))] [DependsOn(typeof(AbpObjectExtendingModule))] public class AbpDataProtectionAbstractionsModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add() + .AddVirtualJson("/LINGYUN/Abp/DataProtection/Localization/Resources"); + }); + } } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json new file mode 100644 index 000000000..ff637aac0 --- /dev/null +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json @@ -0,0 +1,6 @@ +{ + "culture": "en", + "texts": { + "DataProtection:010001": "Data access permission not granted to protected resources!" + } +} \ No newline at end of file diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..964c7ab93 --- /dev/null +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hans", + "texts": { + "DataProtection:010001": "未授予受保护资源的数据访问权限!" + } +} \ No newline at end of file diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs index 66f89f104..59066b21f 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs @@ -1,6 +1,4 @@ -using System; - -namespace System.Reflection; +namespace System.Reflection; internal static class NullableTypeExtensions { diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs index 7dfcca1a0..400ad6085 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs @@ -1,11 +1,12 @@ -using Volo.Abp.Application.Services; +using LINGYUN.Abp.DataProtection.Localization; +using Volo.Abp.Application.Services; namespace LINGYUN.Abp.DataProtectionManagement; public abstract class DataProtectionManagementApplicationServiceBase : ApplicationService { protected DataProtectionManagementApplicationServiceBase() { - LocalizationResource = typeof(AbpDataProtectionManagementApplicationModule); + LocalizationResource = typeof(DataProtectionResource); ObjectMapperContext = typeof(AbpDataProtectionManagementApplicationModule); } } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj index 8abcfdc0c..4e27439f9 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj @@ -13,6 +13,16 @@ + + + + + + + + + + diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs index 59635febc..da5fb9ae4 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs @@ -1,10 +1,34 @@ -using Volo.Abp.Domain; +using LINGYUN.Abp.DataProtection; +using LINGYUN.Abp.DataProtection.Localization; +using Volo.Abp.Domain; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.DataProtectionManagement; [DependsOn(typeof(AbpDddDomainSharedModule))] +[DependsOn(typeof(AbpDataProtectionAbstractionsModule))] public class AbpDataProtectionManagementDomainSharedModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/LINGYUN/Abp/DataProtectionManagement/Localization/Resources"); + }); + + Configure(options => + { + options.MapCodeNamespace(DataProtectionManagementErrorCodes.Namespace, typeof(DataProtectionResource)); + }); + } } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/en.json b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/en.json new file mode 100644 index 000000000..f25078dce --- /dev/null +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/en.json @@ -0,0 +1,9 @@ +{ + "culture": "en", + "texts": { + "DataProtectionManagement:001100": "There already exists an entity type definition named {Name}!", + "DataProtectionManagement:001200": "The entity type already has a property definition named {Name}!", + "DataProtectionManagement:002100": "The {Operation} access rule for entity {Name} has been assigned to role {RoleName}!", + "DataProtectionManagement:003100": "The {Operation} access rule for entity {Name} has been assigned to organization {RoleName}!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..2e1047a28 --- /dev/null +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/zh-Hans.json @@ -0,0 +1,9 @@ +{ + "culture": "zh-Hans", + "texts": { + "DataProtectionManagement:001100": "已经存在名为 {Name} 的实体类型定义!", + "DataProtectionManagement:001200": "实体类型已经存在名为 {Name} 的属性定义!", + "DataProtectionManagement:002100": "已为角色 {RoleName} 分配了实体 {Name} 的 {Operation} 访问规则!", + "DataProtectionManagement:003100": "已为组织机构 {OrgCode} 分配了实体 {Name} 的 {Operation} 访问规则!" + } +} \ No newline at end of file