Browse Source

Merge pull request #952 from colinin/rel-8.1.2

upgrade: upgrade abp framework to 8.1.2
pull/955/head
yx lin 2 years ago
committed by GitHub
parent
commit
63751c1ec3
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/publish.yml
  2. 4
      .github/workflows/release.yml
  3. 7
      Directory.Packages.props
  4. 32
      aspnet-core/LINGYUN.MicroService.All.sln
  5. 3
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/FodyWeavers.xml
  6. 15
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/LINGYUN.Abp.Aliyun.Features.csproj
  7. 27
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/LINGYUN/Abp/Aliyun/Features/AliyunFeatureDefinitionProvider.cs
  8. 38
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/LINGYUN/Abp/Aliyun/Features/AliyunFeatureNames.cs
  9. 138
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs
  10. 5
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN.Abp.Aliyun.csproj
  11. 4
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/AbpAliyunModule.cs
  12. 3
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/AcsClientFactory.cs
  13. 53
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Features/AliyunFeatureDefinitionProvider.cs
  14. 38
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Features/AliyunFeatureNames.cs
  15. 11
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/en.json
  16. 43
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/zh-Hans.json
  17. 1
      aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs
  18. 47
      aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TencentCloudSettingAppService.cs
  19. 6
      aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs
  20. 11
      aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs
  21. 8
      aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/IOssClientFactory.cs
  22. 25
      aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/OssClientFactory.cs
  23. 10
      aspnet-core/framework/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/AliyunSmsSender.cs
  24. 84
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.Authorization/LINGYUN/Abp/OpenApi/Authorization/OpenApiAuthorizationService.cs
  25. 3
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/FodyWeavers.xml
  26. 30
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/FodyWeavers.xsd
  27. 19
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/LINGYUN.Abp.OpenApi.IdentityServer.csproj
  28. 11
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/LINGYUN/Abp/OpenApi/IdentityServer/AbpOpenApiIdentityServerModule.cs
  29. 70
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/LINGYUN/Abp/OpenApi/IdentityServer/IdentityServerAppKeyStore.cs
  30. 3
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/FodyWeavers.xml
  31. 30
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/FodyWeavers.xsd
  32. 19
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/LINGYUN.Abp.OpenApi.OpenIddict.csproj
  33. 11
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/LINGYUN/Abp/OpenApi/OpenIddict/AbpOpenApiOpenIddictModule.cs
  34. 59
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/LINGYUN/Abp/OpenApi/OpenIddict/OpenIddictAppKeyStore.cs
  35. 3
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/AbpOpenApiConsts.cs
  36. 15
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/AlwaysAllowClientChecker.cs
  37. 15
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/AlwaysAllowIpAddressChecker.cs
  38. 10
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/ConfigurationStore/DefaultAppKeyStore.cs
  39. 14
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/IAppKeyStore.cs
  40. 9
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/IClientChecker.cs
  41. 8
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/IIpAddressChecker.cs
  42. 4
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/Localization/Resources/en.json
  43. 4
      aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/Localization/Resources/zh-Hans.json
  44. 8
      aspnet-core/framework/pushplus/LINGYUN.Abp.PushPlus.SettingManagement/LINGYUN/Abp/PushPlus/SettingManagement/PushPlusSettingAppService.cs
  45. 4
      aspnet-core/framework/pushplus/LINGYUN.Abp.PushPlus.SettingManagement/LINGYUN/Abp/PushPlus/SettingManagement/PushPlusSettingController.cs
  46. 12
      aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingAppService.cs
  47. 4
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement/LINGYUN/Abp/WxPusher/SettingManagement/WxPusherSettingAppService.cs
  48. 1
      aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher/LINGYUN.Abp.WxPusher.csproj
  49. 938
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20240527092536_Remote-Tenant-Id-With-Text-Template.Designer.cs
  50. 48
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20240527092536_Remote-Tenant-Id-With-Text-Template.cs
  51. 6
      aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/BackendAdminMigrationsDbContextModelSnapshot.cs
  52. 2
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat.Work/LINGYUN/Abp/IdentityServer/WeChat/Work/WeChatWorkGrantValidator.cs
  53. 2
      aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat.Work/LINGYUN/Abp/OpenIddict/WeChat/Work/WeChatWorkTokenExtensionGrant.cs
  54. 2
      aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Aliyun/LINGYUN/Abp/OssManagement/Aliyun/AliyunOssContainer.cs
  55. 6
      aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.SettingManagement/LINGYUN/Abp/OssManagement/SettingManagement/OssManagementSettingAppService.cs
  56. 1
      aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/LINGYUN/Abp/PermissionManagement/OrganizationUnits/OrganizationUnitDeletedEventHandler.cs
  57. 4
      aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/LINGYUN/Abp/PermissionManagement/OrganizationUnits/OrganizationUnitPermissionManagementProvider.cs
  58. 12
      aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/Volo/Abp/PermissionManagement/OrganizationUnitPermissionManagerExtensions.cs
  59. 2
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/NotificationDefinitionInitializer.cs
  60. 154
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs
  61. 16
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobListener.cs
  62. 8
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateEto.cs
  63. 7
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/IStaticTemplateDefinitionSaver.cs
  64. 9
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/IStaticTemplateSaver.cs
  65. 2
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/InMemoryTemplateDefinitionStoreCache.cs
  66. 225
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/StaticTemplateSaver.cs
  67. 4
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplate.cs
  68. 5
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateCacheItemInvalidator.cs
  69. 2
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentCacheItem.cs
  70. 9
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs
  71. 6
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionInitializer.cs
  72. 2
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbContextModelCreatingExtensions.cs
  73. 3
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/FodyWeavers.xml
  74. 30
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/FodyWeavers.xsd
  75. 18
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN.Abp.TextTemplating.Scriban.csproj
  76. 17
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/AbpTextTemplatingScribanModule.cs
  77. 12
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateDefinitionExtensions.cs
  78. 64
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateLocalizer.cs
  79. 154
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateRenderingEngine.cs
  80. 11
      aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/AuthServerHttpApiHostModule.Configure.cs
  81. 3
      aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/AuthServerHttpApiHostModule.cs
  82. 9
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs
  83. 21
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs
  84. 6
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj
  85. 11
      aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/IdentityServerHttpApiHostModule.Configure.cs
  86. 3
      aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs
  87. 9
      aspnet-core/services/LY.MicroService.IdentityServer/IdentityServerModule.Configure.cs
  88. 11
      aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.Configure.cs
  89. 3
      aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.cs
  90. 11
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs
  91. 4
      aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs
  92. 1
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj
  93. 21
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs
  94. 9
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs
  95. 9
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/TaskManagementHttpApiHostModule.Configure.cs
  96. 1
      aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/TaskManagementHttpApiHostModule.cs
  97. 9
      aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.Configure.cs
  98. 1
      aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs
  99. 8
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs
  100. 1
      aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs

2
.github/workflows/publish.yml

@ -2,7 +2,7 @@ name: "Publish"
on: on:
push: push:
branches: [ rel-8.1.1 ] branches: [ rel-8.1.2 ]
env: env:
DOTNET_VERSION: "8.0.200" DOTNET_VERSION: "8.0.200"

4
.github/workflows/release.yml

@ -2,7 +2,7 @@ name: "Tagged Release"
on: on:
push: push:
branches: [ rel-8.1.1 ] branches: [ rel-8.1.2 ]
jobs: jobs:
tagged-release: tagged-release:
@ -14,4 +14,4 @@ jobs:
with: with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false prerelease: false
automatic_release_tag: "8.1.1" automatic_release_tag: "8.1.2"

7
Directory.Packages.props

@ -2,8 +2,8 @@
<PropertyGroup> <PropertyGroup>
<DotNetCoreCAPPackageVersion>8.1.1</DotNetCoreCAPPackageVersion> <DotNetCoreCAPPackageVersion>8.1.1</DotNetCoreCAPPackageVersion>
<ElsaPackageVersion>2.14.1</ElsaPackageVersion> <ElsaPackageVersion>2.14.1</ElsaPackageVersion>
<VoloAbpPackageVersion>8.1.1</VoloAbpPackageVersion> <VoloAbpPackageVersion>8.1.2</VoloAbpPackageVersion>
<LINGYUNAbpPackageVersion>8.1.1</LINGYUNAbpPackageVersion> <LINGYUNAbpPackageVersion>8.1.2</LINGYUNAbpPackageVersion>
<MicrosoftExtensionsPackageVersion>8.0.0</MicrosoftExtensionsPackageVersion> <MicrosoftExtensionsPackageVersion>8.0.0</MicrosoftExtensionsPackageVersion>
<MicrosoftAspNetCorePackageVersion>8.0.0</MicrosoftAspNetCorePackageVersion> <MicrosoftAspNetCorePackageVersion>8.0.0</MicrosoftAspNetCorePackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>8.0.0</MicrosoftEntityFrameworkCorePackageVersion> <MicrosoftEntityFrameworkCorePackageVersion>8.0.0</MicrosoftEntityFrameworkCorePackageVersion>
@ -244,6 +244,7 @@
<PackageVersion Include="Polly" Version="8.2.0" /> <PackageVersion Include="Polly" Version="8.2.0" />
<PackageVersion Include="Quartz.Serialization.Json" Version="3.7.0" /> <PackageVersion Include="Quartz.Serialization.Json" Version="3.7.0" />
<PackageVersion Include="RulesEngine" Version="4.0.0" /> <PackageVersion Include="RulesEngine" Version="4.0.0" />
<PackageVersion Include="Scriban" Version="5.9.0" />
<PackageVersion Include="Senparc.Weixin.MP" Version="16.18.9" /> <PackageVersion Include="Senparc.Weixin.MP" Version="16.18.9" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.0.2" /> <PackageVersion Include="SixLabors.ImageSharp" Version="3.0.2" />
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="2.0.1" /> <PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="2.0.1" />
@ -252,6 +253,6 @@
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="Tencent.QCloud.Cos.Sdk" Version="5.4.37" /> <PackageVersion Include="Tencent.QCloud.Cos.Sdk" Version="5.4.37" />
<PackageVersion Include="TencentCloudSDK" Version="3.0.712" /> <PackageVersion Include="TencentCloudSDK" Version="3.0.712" />
<PackageVersion Include="Yarp.ReverseProxy" Version="1.1.1" /> <PackageVersion Include="Yarp.ReverseProxy" Version="2.1.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

32
aspnet-core/LINGYUN.MicroService.All.sln

@ -106,6 +106,9 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Platform.HttpApi", "modules\platform\LINGYUN.Platform.HttpApi\LINGYUN.Platform.HttpApi.csproj", "{5FBBBA6A-D6EC-42E1-8164-15C411EC77BE}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Platform.HttpApi", "modules\platform\LINGYUN.Platform.HttpApi\LINGYUN.Platform.HttpApi.csproj", "{5FBBBA6A-D6EC-42E1-8164-15C411EC77BE}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin", "admin", "{F4615BCE-D5C1-407A-8681-8EEE92DEF9D0}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin", "admin", "{F4615BCE-D5C1-407A-8681-8EEE92DEF9D0}"
ProjectSection(SolutionItems) = preProject
..\..\upgrade\aspnet-core\services\LY.MicroService.BackendAdmin.HttpApi.Host\appsettings.Production.json = ..\..\upgrade\aspnet-core\services\LY.MicroService.BackendAdmin.HttpApi.Host\appsettings.Production.json
EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.EntityFrameworkCore.Tests", "tests\LINGYUN.Abp.EntityFrameworkCore.Tests\LINGYUN.Abp.EntityFrameworkCore.Tests.csproj", "{F3D9B137-32DE-4018-8058-78AB17FCDF9C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.EntityFrameworkCore.Tests", "tests\LINGYUN.Abp.EntityFrameworkCore.Tests\LINGYUN.Abp.EntityFrameworkCore.Tests.csproj", "{F3D9B137-32DE-4018-8058-78AB17FCDF9C}"
EndProject EndProject
@ -728,13 +731,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionM
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.Wrapper", "framework\common\LINGYUN.Abp.AspNetCore.Wrapper\LINGYUN.Abp.AspNetCore.Wrapper.csproj", "{30FB6AD7-3CC5-4A8D-B170-BDA772E6BA3C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.AspNetCore.Wrapper", "framework\common\LINGYUN.Abp.AspNetCore.Wrapper\LINGYUN.Abp.AspNetCore.Wrapper.csproj", "{30FB6AD7-3CC5-4A8D-B170-BDA772E6BA3C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.DataProtectionManagement.Application.Contracts", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Application.Contracts\LINGYUN.Abp.DataProtectionManagement.Application.Contracts.csproj", "{40D7A0A3-68BD-431E-A67A-E2A35508D55D}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.Application.Contracts", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Application.Contracts\LINGYUN.Abp.DataProtectionManagement.Application.Contracts.csproj", "{40D7A0A3-68BD-431E-A67A-E2A35508D55D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.Application", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Application\LINGYUN.Abp.DataProtectionManagement.Application.csproj", "{8EA8C998-F81A-46E9-8C7E-C944D2503A0A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.Abstractions", "framework\data-protection\LINGYUN.Abp.DataProtection.Abstractions\LINGYUN.Abp.DataProtection.Abstractions.csproj", "{47550AB9-FA06-42D6-A4B8-7DD12FE66563}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.HttpApi", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.HttpApi\LINGYUN.Abp.DataProtectionManagement.HttpApi.csproj", "{835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.DataProtectionManagement.Application", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Application\LINGYUN.Abp.DataProtectionManagement.Application.csproj", "{8EA8C998-F81A-46E9-8C7E-C944D2503A0A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OpenApi.IdentityServer", "framework\open-api\LINGYUN.Abp.OpenApi.IdentityServer\LINGYUN.Abp.OpenApi.IdentityServer.csproj", "{FDAAAD2E-42A7-44EC-8971-B5277FD6D404}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.DataProtection.Abstractions", "framework\data-protection\LINGYUN.Abp.DataProtection.Abstractions\LINGYUN.Abp.DataProtection.Abstractions.csproj", "{47550AB9-FA06-42D6-A4B8-7DD12FE66563}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OpenApi.OpenIddict", "framework\open-api\LINGYUN.Abp.OpenApi.OpenIddict\LINGYUN.Abp.OpenApi.OpenIddict.csproj", "{ED3DF100-C5DB-4334-A847-118922B28D95}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.DataProtectionManagement.HttpApi", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.HttpApi\LINGYUN.Abp.DataProtectionManagement.HttpApi.csproj", "{835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.TextTemplating.Scriban", "modules\text-templating\LINGYUN.Abp.TextTemplating.Scriban\LINGYUN.Abp.TextTemplating.Scriban.csproj", "{15482834-9242-4D20-9736-9DA571A9A83A}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -1874,6 +1883,18 @@ Global
{835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}.Debug|Any CPU.Build.0 = Debug|Any CPU {835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}.Release|Any CPU.ActiveCfg = Release|Any CPU {835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}.Release|Any CPU.Build.0 = Release|Any CPU {835E51CE-1E6B-4C8C-9736-8C5B61F5E08E}.Release|Any CPU.Build.0 = Release|Any CPU
{FDAAAD2E-42A7-44EC-8971-B5277FD6D404}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDAAAD2E-42A7-44EC-8971-B5277FD6D404}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDAAAD2E-42A7-44EC-8971-B5277FD6D404}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDAAAD2E-42A7-44EC-8971-B5277FD6D404}.Release|Any CPU.Build.0 = Release|Any CPU
{ED3DF100-C5DB-4334-A847-118922B28D95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED3DF100-C5DB-4334-A847-118922B28D95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED3DF100-C5DB-4334-A847-118922B28D95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED3DF100-C5DB-4334-A847-118922B28D95}.Release|Any CPU.Build.0 = Release|Any CPU
{15482834-9242-4D20-9736-9DA571A9A83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15482834-9242-4D20-9736-9DA571A9A83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15482834-9242-4D20-9736-9DA571A9A83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15482834-9242-4D20-9736-9DA571A9A83A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -2229,6 +2250,9 @@ Global
{8EA8C998-F81A-46E9-8C7E-C944D2503A0A} = {F6A9D966-0022-440B-AE27-564A74CDED48} {8EA8C998-F81A-46E9-8C7E-C944D2503A0A} = {F6A9D966-0022-440B-AE27-564A74CDED48}
{47550AB9-FA06-42D6-A4B8-7DD12FE66563} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3} {47550AB9-FA06-42D6-A4B8-7DD12FE66563} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3}
{835E51CE-1E6B-4C8C-9736-8C5B61F5E08E} = {F6A9D966-0022-440B-AE27-564A74CDED48} {835E51CE-1E6B-4C8C-9736-8C5B61F5E08E} = {F6A9D966-0022-440B-AE27-564A74CDED48}
{FDAAAD2E-42A7-44EC-8971-B5277FD6D404} = {3C7A8246-DE82-4330-8697-24EF1B1C515D}
{ED3DF100-C5DB-4334-A847-118922B28D95} = {3C7A8246-DE82-4330-8697-24EF1B1C515D}
{15482834-9242-4D20-9736-9DA571A9A83A} = {ABD89F39-62D9-439E-8662-BE4F36BFA04F}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}

3
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

15
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/LINGYUN.Abp.Aliyun.Features.csproj

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Features" />
</ItemGroup>
</Project>

27
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/LINGYUN/Abp/Aliyun/Features/AliyunFeatureDefinitionProvider.cs

@ -0,0 +1,27 @@
using LINGYUN.Abp.Aliyun.Localization;
using Volo.Abp.Features;
using Volo.Abp.Localization;
using Volo.Abp.Validation.StringValues;
namespace LINGYUN.Abp.Aliyun.Features;
public class AliyunFeatureDefinitionProvider : FeatureDefinitionProvider
{
public override void Define(IFeatureDefinitionContext context)
{
var featureGroup = context.AddGroup(
name: AliyunFeatureNames.GroupName,
displayName: L("Features:AlibabaCloud"));
featureGroup.AddFeature(
name: AliyunFeatureNames.IsEnabled,
defaultValue: false.ToString(),
displayName: L("Features:AlibabaCloud:IsEnabled"),
description: L("Features:AlibabaCloud:IsEnabledDesc"),
valueType: new ToggleStringValueType(new BooleanValueValidator()));
}
private static ILocalizableString L(string name)
{
return LocalizableString.Create<AliyunResource>(name);
}
}

38
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.Features/LINGYUN/Abp/Aliyun/Features/AliyunFeatureNames.cs

@ -0,0 +1,38 @@
namespace LINGYUN.Abp.Aliyun.Features;
public static class AliyunFeatureNames
{
public const string GroupName = "AlibabaCloud";
public const string IsEnabled = GroupName + ".IsEnabled";
public static class Sms
{
public const string Default = GroupName + ".Sms";
public const string IsEnabled = Default + ".IsEnabled";
/// <summary>
/// 发送次数上限
/// </summary>
public const string SendLimit = Default + ".SendLimit";
/// <summary>
/// 发送次数上限时长
/// </summary>
public const string SendLimitInterval = Default + ".SendLimitInterval";
/// <summary>
/// 默认发送次数上限
/// </summary>
public const int DefaultSendLimit = 1000;
/// <summary>
/// 默认发送次数上限时长
/// </summary>
public const int DefaultSendLimitInterval = 1;
}
public static class Oss
{
public const string Default = GroupName + ".Sms";
public const string IsEnabled = GroupName + ".IsEnabled";
}
}

138
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs

@ -1,6 +1,8 @@
using LINGYUN.Abp.Aliyun.Localization; using LINGYUN.Abp.Aliyun.Features;
using LINGYUN.Abp.Aliyun.Localization;
using LINGYUN.Abp.Aliyun.Settings; using LINGYUN.Abp.Aliyun.Settings;
using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.SettingManagement;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.Permissions;
@ -43,7 +45,8 @@ namespace LINGYUN.Abp.Aliyun.SettingManagement
var settingGroups = new SettingGroupResult(); var settingGroups = new SettingGroupResult();
// 无权限返回空结果,直接报错的话,网关聚合会抛出异常 // 无权限返回空结果,直接报错的话,网关聚合会抛出异常
if (await PermissionChecker.IsGrantedAsync(AliyunSettingPermissionNames.Settings)) if (await FeatureChecker.IsEnabledAsync(AliyunFeatureNames.Enable) &&
await PermissionChecker.IsGrantedAsync(AliyunSettingPermissionNames.Settings))
{ {
var aliyunSettingGroup = new SettingGroupDto(L["DisplayName:Aliyun"], L["Description:Aliyun"]); var aliyunSettingGroup = new SettingGroupDto(L["DisplayName:Aliyun"], L["Description:Aliyun"]);
#region 访问控制 #region 访问控制
@ -54,8 +57,9 @@ namespace LINGYUN.Abp.Aliyun.SettingManagement
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Authorization.RegionId), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Authorization.RegionId),
StringLocalizerFactory, StringLocalizerFactory,
await SettingManager.GetOrNullAsync(AliyunSettingNames.Authorization.RegionId, providerName, providerKey), await SettingManager.GetOrNullAsync(AliyunSettingNames.Authorization.RegionId, providerName, providerKey),
ValueType.String, ValueType.Option,
providerName); providerName)
.AddOptions(GetAvailableRegionOptions());
ramSetting.AddDetail( ramSetting.AddDetail(
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Authorization.AccessKeyId), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Authorization.AccessKeyId),
StringLocalizerFactory, StringLocalizerFactory,
@ -103,49 +107,52 @@ namespace LINGYUN.Abp.Aliyun.SettingManagement
#region 短信 #region 短信
var smsSetting = aliyunSettingGroup.AddSetting(L["DisplayName:Aliyun.Sms"], L["Description:Aliyun.Sms"]); if (await FeatureChecker.IsEnabledAsync(AliyunFeatureNames.Sms.Enable))
smsSetting.AddDetail( {
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.Domain), var smsSetting = aliyunSettingGroup.AddSetting(L["DisplayName:Aliyun.Sms"], L["Description:Aliyun.Sms"]);
StringLocalizerFactory, smsSetting.AddDetail(
await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.Domain, providerName, providerKey), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.Domain),
ValueType.String, StringLocalizerFactory,
providerName); await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.Domain, providerName, providerKey),
smsSetting.AddDetail( ValueType.String,
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.Version), providerName);
StringLocalizerFactory, smsSetting.AddDetail(
await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.Version, providerName, providerKey), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.Version),
ValueType.String, StringLocalizerFactory,
providerName); await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.Version, providerName, providerKey),
smsSetting.AddDetail( ValueType.String,
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.ActionName), providerName);
StringLocalizerFactory, smsSetting.AddDetail(
await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.ActionName, providerName, providerKey), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.ActionName),
ValueType.String, StringLocalizerFactory,
providerName); await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.ActionName, providerName, providerKey),
smsSetting.AddDetail( ValueType.String,
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.DefaultPhoneNumber), providerName);
StringLocalizerFactory, smsSetting.AddDetail(
await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultPhoneNumber, providerName, providerKey), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.DefaultPhoneNumber),
ValueType.String, StringLocalizerFactory,
providerName); await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultPhoneNumber, providerName, providerKey),
smsSetting.AddDetail( ValueType.String,
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.DefaultSignName), providerName);
StringLocalizerFactory, smsSetting.AddDetail(
await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultSignName, providerName, providerKey), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.DefaultSignName),
ValueType.String, StringLocalizerFactory,
providerName); await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultSignName, providerName, providerKey),
smsSetting.AddDetail( ValueType.String,
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.DefaultTemplateCode), providerName);
StringLocalizerFactory, smsSetting.AddDetail(
await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultTemplateCode, providerName, providerKey), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.DefaultTemplateCode),
ValueType.String, StringLocalizerFactory,
providerName); await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.DefaultTemplateCode, providerName, providerKey),
smsSetting.AddDetail( ValueType.String,
await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.VisableErrorToClient), providerName);
StringLocalizerFactory, smsSetting.AddDetail(
await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.VisableErrorToClient, providerName, providerKey), await SettingDefinitionManager.GetAsync(AliyunSettingNames.Sms.VisableErrorToClient),
ValueType.Boolean, StringLocalizerFactory,
providerName); await SettingManager.GetOrNullAsync(AliyunSettingNames.Sms.VisableErrorToClient, providerName, providerKey),
ValueType.Boolean,
providerName);
}
#endregion #endregion
@ -154,5 +161,42 @@ namespace LINGYUN.Abp.Aliyun.SettingManagement
return settingGroups; return settingGroups;
} }
protected virtual IEnumerable<OptionDto> GetAvailableRegionOptions()
{
return new OptionDto[]
{
new OptionDto(L["Region:HangZhou"], "oss-cn-hangzhou"),
new OptionDto(L["Region:ShangHai"], "oss-cn-shanghai"),
new OptionDto(L["Region:NanJing"], "oss-cn-nanjing"),
new OptionDto(L["Region:FuZhou"], "oss-cn-fuzhou"),
new OptionDto(L["Region:WuHan"], "oss-cn-wuhan"),
new OptionDto(L["Region:QingDao"], "oss-cn-qingdao"),
new OptionDto(L["Region:BeiJing"], "oss-cn-beijing"),
new OptionDto(L["Region:ZhangJiaKou"], "oss-cn-zhangjiakou"),
new OptionDto(L["Region:HuHeHaoTe"], "oss-cn-huhehaote"),
new OptionDto(L["Region:WuLanChaBu"], "oss-cn-wulanchabu"),
new OptionDto(L["Region:ShenZhen"], "oss-cn-shenzhen"),
new OptionDto(L["Region:HeYuan"], "oss-cn-heyuan"),
new OptionDto(L["Region:GuangZhou"], "oss-cn-guangzhou"),
new OptionDto(L["Region:ChengDu"], "oss-cn-chengdu"),
new OptionDto(L["Region:HongKong"], "oss-cn-hongkong"),
new OptionDto(L["Region:SiliconValley"], "oss-us-west-1"),
new OptionDto(L["Region:Virginia"], "oss-us-east-1"),
new OptionDto(L["Region:Tokoyo"], "oss-ap-northeast-1"),
new OptionDto(L["Region:Seoul"], "oss-ap-northeast-2"),
new OptionDto(L["Region:Singapore"], "oss-ap-southeast-1"),
new OptionDto(L["Region:Sydney"], "oss-ap-southeast-2"),
new OptionDto(L["Region:KualaLumpur"], "oss-ap-southeast-3"),
new OptionDto(L["Region:Jakarta"], "oss-ap-southeast-5"),
new OptionDto(L["Region:Manila"], "oss-ap-southeast-6"),
new OptionDto(L["Region:Bangkok"], "oss-ap-southeast-7"),
new OptionDto(L["Region:Bombay"], "oss-ap-south-1"),
new OptionDto(L["Region:Frankfurt"], "oss-eu-central-1"),
new OptionDto(L["Region:London"], "oss-eu-west-1"),
new OptionDto(L["Region:Dubai"], "oss-me-east-1"),
new OptionDto(L["Region:MainLand"], "oss-rg-china-mainland"),
};
}
} }
} }

5
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN.Abp.Aliyun.csproj

@ -22,9 +22,14 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="aliyun-net-sdk-core" /> <PackageReference Include="aliyun-net-sdk-core" />
<PackageReference Include="Volo.Abp.Caching" /> <PackageReference Include="Volo.Abp.Caching" />
<PackageReference Include="Volo.Abp.Features" />
<PackageReference Include="Volo.Abp.Localization" /> <PackageReference Include="Volo.Abp.Localization" />
<PackageReference Include="Volo.Abp.Json" /> <PackageReference Include="Volo.Abp.Json" />
<PackageReference Include="Volo.Abp.Settings" /> <PackageReference Include="Volo.Abp.Settings" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\common\LINGYUN.Abp.Features.LimitValidation\LINGYUN.Abp.Features.LimitValidation.csproj" />
</ItemGroup>
</Project> </Project>

4
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/AbpAliyunModule.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.Aliyun.Localization; using LINGYUN.Abp.Aliyun.Localization;
using LINGYUN.Abp.Features.LimitValidation;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Json; using Volo.Abp.Json;
using Volo.Abp.Localization; using Volo.Abp.Localization;
@ -12,7 +13,8 @@ namespace LINGYUN.Abp.Aliyun
typeof(AbpCachingModule), typeof(AbpCachingModule),
typeof(AbpSettingsModule), typeof(AbpSettingsModule),
typeof(AbpJsonModule), typeof(AbpJsonModule),
typeof(AbpLocalizationModule))] typeof(AbpLocalizationModule),
typeof(AbpFeaturesLimitValidationModule))]
public class AbpAliyunModule : AbpModule public class AbpAliyunModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)

3
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/AcsClientFactory.cs

@ -1,12 +1,15 @@
using Aliyun.Acs.Core; using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Auth; using Aliyun.Acs.Core.Auth;
using Aliyun.Acs.Core.Profile; using Aliyun.Acs.Core.Profile;
using LINGYUN.Abp.Aliyun.Features;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Features;
using Volo.Abp.Settings; using Volo.Abp.Settings;
namespace LINGYUN.Abp.Aliyun namespace LINGYUN.Abp.Aliyun
{ {
[RequiresFeature(AliyunFeatureNames.Enable)]
public class AcsClientFactory : AliyunClientFactory<IAcsClient>, IAcsClientFactory, ITransientDependency public class AcsClientFactory : AliyunClientFactory<IAcsClient>, IAcsClientFactory, ITransientDependency
{ {
public AcsClientFactory( public AcsClientFactory(

53
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Features/AliyunFeatureDefinitionProvider.cs

@ -0,0 +1,53 @@
using LINGYUN.Abp.Aliyun.Localization;
using Volo.Abp.Features;
using Volo.Abp.Localization;
using Volo.Abp.Validation.StringValues;
namespace LINGYUN.Abp.Aliyun.Features;
public class AliyunFeatureDefinitionProvider : FeatureDefinitionProvider
{
public override void Define(IFeatureDefinitionContext context)
{
var featureGroup = context.AddGroup(
name: AliyunFeatureNames.GroupName,
displayName: L("Features:AlibabaCloud"));
featureGroup.AddFeature(
name: AliyunFeatureNames.Enable,
defaultValue: false.ToString(),
displayName: L("Features:AlibabaCloud:IsEnabled"),
description: L("Features:AlibabaCloud:IsEnabledDesc"),
valueType: new ToggleStringValueType(new BooleanValueValidator()));
var smsFeature = featureGroup.AddFeature(
name: AliyunFeatureNames.Sms.Enable,
defaultValue: false.ToString(),
displayName: L("Features:AlibabaCloud:Sms"),
description: L("Features:AlibabaCloud:SmsDesc"),
valueType: new ToggleStringValueType(new BooleanValueValidator()));
smsFeature.CreateChild(
name: AliyunFeatureNames.Sms.SendLimit,
defaultValue: AliyunFeatureNames.Sms.DefaultSendLimit.ToString(),
displayName: L("Features:AlibabaCloud:Sms.SendLimit"),
description: L("Features:AlibabaCloud:Sms.SendLimitDesc"),
valueType: new FreeTextStringValueType(new NumericValueValidator(1, 100_0000)));
smsFeature.CreateChild(
name: AliyunFeatureNames.Sms.SendLimitInterval,
defaultValue: AliyunFeatureNames.Sms.DefaultSendLimitInterval.ToString(),
displayName: L("Features:AlibabaCloud:Sms.SendLimitInterval"),
description: L("Features:AlibabaCloud:Sms.SendLimitIntervalDesc"),
valueType: new FreeTextStringValueType(new NumericValueValidator(1, 100_0000)));
var blobFeature = featureGroup.AddFeature(
name: AliyunFeatureNames.BlobStoring.Enable,
defaultValue: false.ToString(),
displayName: L("Features:AlibabaCloud:Oss"),
description: L("Features:AlibabaCloud:OssDesc"),
valueType: new ToggleStringValueType(new BooleanValueValidator()));
}
private static ILocalizableString L(string name)
{
return LocalizableString.Create<AliyunResource>(name);
}
}

38
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Features/AliyunFeatureNames.cs

@ -0,0 +1,38 @@
namespace LINGYUN.Abp.Aliyun.Features;
public static class AliyunFeatureNames
{
public const string GroupName = "AlibabaCloud";
public const string Enable = GroupName + ".Enable";
public static class Sms
{
public const string Default = GroupName + ".Sms";
public const string Enable = Default + ".Enable";
/// <summary>
/// 发送次数上限
/// </summary>
public const string SendLimit = Default + ".SendLimit";
/// <summary>
/// 发送次数上限时长
/// </summary>
public const string SendLimitInterval = Default + ".SendLimitInterval";
/// <summary>
/// 默认发送次数上限
/// </summary>
public const int DefaultSendLimit = 1000;
/// <summary>
/// 默认发送次数上限时长
/// </summary>
public const int DefaultSendLimitInterval = 1;
}
public static class BlobStoring
{
public const string Default = GroupName + ".BlobStoring";
public const string Enable = Default + ".Enable";
}
}

11
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/en.json

@ -1,6 +1,17 @@
{ {
"culture": "en", "culture": "en",
"texts": { "texts": {
"Features:AlibabaCloud": "Alibaba Cloud",
"Features:AlibabaCloud:IsEnabled": "Enabling Alibaba Cloud Services",
"Features:AlibabaCloud:IsEnabledDesc": "Enable the ability to enable applications to have Alibaba Cloud services.",
"Features:AlibabaCloud:Sms": "Alibaba Cloud Sms Service",
"Features:AlibabaCloud:SmsDesc": "Enable the ability to use Alibaba Cloud SMS services.",
"Features:AlibabaCloud:Sms.SendLimit": "Sending SMS restriction",
"Features:AlibabaCloud:Sms.SendLimitDesc": "Limit SMS service calls within a certain period of time",
"Features:AlibabaCloud:Sms.SendLimitInterval": "Limit the duration of sending text messages",
"Features:AlibabaCloud:Sms.SendLimitIntervalDesc": "Limit the duration of template SMS service call limit, with a cycle of months",
"Features:AlibabaCloud:Oss": "Alibaba Cloud Oss Service",
"Features:AlibabaCloud:OssDesc": "Enable the ability to use Alibaba Cloud Oss services.",
"DisplayName:Aliyun.RAM": "RAM", "DisplayName:Aliyun.RAM": "RAM",
"Description:Aliyun.RAM": "RAM", "Description:Aliyun.RAM": "RAM",
"DisplayName:Authorization": "Authorization", "DisplayName:Authorization": "Authorization",

43
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Localization/Resources/zh-Hans.json

@ -1,6 +1,17 @@
{ {
"culture": "zh-Hans", "culture": "zh-Hans",
"texts": { "texts": {
"Features:AlibabaCloud": "阿里云服务",
"Features:AlibabaCloud:IsEnabled": "启用阿里云服务",
"Features:AlibabaCloud:IsEnabledDesc": "启用使应用程序拥有阿里云服务的能力.",
"Features:AlibabaCloud:Sms": "阿里云短信",
"Features:AlibabaCloud:SmsDesc": "启用以使用阿里云短信服务的能力.",
"Features:AlibabaCloud:Sms.SendLimit": "发送短信限制",
"Features:AlibabaCloud:Sms.SendLimitDesc": "在一定周期内限制短信服务调用上限",
"Features:AlibabaCloud:Sms.SendLimitInterval": "发送短信限制时长",
"Features:AlibabaCloud:Sms.SendLimitIntervalDesc": "限制模板短信服务调用上限的时长,周期为月",
"Features:AlibabaCloud:Oss": "阿里云对象存储",
"Features:AlibabaCloud:OssDesc": "启用以使用阿里云对象存储的能力.",
"DisplayName:Aliyun.RAM": "访问控制", "DisplayName:Aliyun.RAM": "访问控制",
"Description:Aliyun.RAM": "阿里云服务访问控制", "Description:Aliyun.RAM": "阿里云服务访问控制",
"DisplayName:Authorization": "阿里云身份认证凭据", "DisplayName:Authorization": "阿里云身份认证凭据",
@ -36,6 +47,36 @@
"DisplayName:Version": "阿里云sms服务版本号", "DisplayName:Version": "阿里云sms服务版本号",
"Description:Version": "阿里云sms服务版本号", "Description:Version": "阿里云sms服务版本号",
"DisplayName:VisableErrorToClient": "发送错误到客户端", "DisplayName:VisableErrorToClient": "发送错误到客户端",
"Description:VisableErrorToClient": "当短信服务发送出现错误时是否发送错误详情到客户端" "Description:VisableErrorToClient": "当短信服务发送出现错误时是否发送错误详情到客户端",
"Region:HangZhou": "华东1(杭州)",
"Region:ShangHai": "华东2(上海)",
"Region:NanJing": "华东5(南京-本地地域)",
"Region:FuZhou": "华东6(福州-本地地域)",
"Region:WuHan": "华中1(武汉-本地地域)",
"Region:QingDao": "华北1(青岛)",
"Region:BeiJing": "华北2(北京)",
"Region:ZhangJiaKou": "华北 3(张家口)",
"Region:HuHeHaoTe": "华北5(呼和浩特)",
"Region:WuLanChaBu": "华北6(乌兰察布)",
"Region:ShenZhen": "华南1(深圳)",
"Region:HeYuan": "华南2(河源)",
"Region:GuangZhou": "华南3(广州)",
"Region:ChengDu": "西南1(成都)",
"Region:HongKong": "中国香港",
"Region:SiliconValley": "美国(硅谷)",
"Region:Virginia": "美国(弗吉尼亚)",
"Region:Tokoyo": "日本(东京)",
"Region:Seoul": "韩国(首尔)",
"Region:Singapore": "新加坡",
"Region:Sydney": "澳大利亚(悉尼)",
"Region:KualaLumpur": "马来西亚(吉隆坡)",
"Region:Jakarta": "印度尼西亚(雅加达)",
"Region:Manila": "菲律宾(马尼拉)",
"Region:Bangkok": "泰国(曼谷)",
"Region:Bombay": "印度(孟买)",
"Region:Frankfurt": "德国(法兰克福)",
"Region:London": "英国(伦敦)",
"Region:Dubai": "阿联酋(迪拜)",
"Region:MainLand": "无地域属性(中国内地)"
} }
} }

1
aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs

@ -78,6 +78,7 @@ namespace LINGYUN.Abp.Aliyun.Settings
TenantSettingValueProvider.ProviderName), TenantSettingValueProvider.ProviderName),
new SettingDefinition( new SettingDefinition(
AliyunSettingNames.Authorization.RegionId, AliyunSettingNames.Authorization.RegionId,
defaultValue: "oss-cn-hangzhou",
displayName: L("DisplayName:RegionId"), displayName: L("DisplayName:RegionId"),
description: L("Description:RegionId"), description: L("Description:RegionId"),
isVisibleToClients: false isVisibleToClients: false

47
aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TencentCloudSettingAppService.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.Tencent.Features;
using LINGYUN.Abp.Tencent.Localization; using LINGYUN.Abp.Tencent.Localization;
using LINGYUN.Abp.Tencent.QQ.Settings; using LINGYUN.Abp.Tencent.QQ.Settings;
using LINGYUN.Abp.Tencent.Settings; using LINGYUN.Abp.Tencent.Settings;
@ -112,27 +113,31 @@ public class TencentCloudSettingAppService : ApplicationService, ITencentCloudSe
#region 短信设置 #region 短信设置
var smsSetting = settingGroup.AddSetting( if (await FeatureChecker.IsEnabledAsync(TencentCloudFeatures.Sms.Enable))
L["DisplayName:TenantCloud.SmsSetting"], L["Description:TenantCloud.SmsSetting"]); {
smsSetting.AddDetail( var smsSetting = settingGroup.AddSetting(
await SettingDefinitionManager.GetAsync(TencentCloudSettingNames.Sms.AppId), L["DisplayName:TenantCloud.SmsSetting"], L["Description:TenantCloud.SmsSetting"]);
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.AppId, providerName, providerKey), smsSetting.AddDetail(
ValueType.String, await SettingDefinitionManager.GetAsync(TencentCloudSettingNames.Sms.AppId),
providerName); StringLocalizerFactory,
smsSetting.AddDetail( await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.AppId, providerName, providerKey),
await SettingDefinitionManager.GetAsync(TencentCloudSettingNames.Sms.DefaultTemplateId), ValueType.String,
StringLocalizerFactory, providerName);
await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultTemplateId, providerName, providerKey), smsSetting.AddDetail(
ValueType.String, await SettingDefinitionManager.GetAsync(TencentCloudSettingNames.Sms.DefaultTemplateId),
providerName); StringLocalizerFactory,
smsSetting.AddDetail( await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultTemplateId, providerName, providerKey),
await SettingDefinitionManager.GetAsync(TencentCloudSettingNames.Sms.DefaultSignName), ValueType.String,
StringLocalizerFactory, providerName);
await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultSignName, providerName, providerKey), smsSetting.AddDetail(
ValueType.String, await SettingDefinitionManager.GetAsync(TencentCloudSettingNames.Sms.DefaultSignName),
providerName); StringLocalizerFactory,
await SettingManager.GetOrNullAsync(TencentCloudSettingNames.Sms.DefaultSignName, providerName, providerKey),
ValueType.String,
providerName);
}
#endregion #endregion

6
aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs

@ -1,13 +1,16 @@
using Aliyun.OSS; using Aliyun.OSS;
using LINGYUN.Abp.Aliyun.Features;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Features;
namespace LINGYUN.Abp.BlobStoring.Aliyun namespace LINGYUN.Abp.BlobStoring.Aliyun
{ {
[RequiresFeature(AliyunFeatureNames.BlobStoring.Enable)]
public class AliyunBlobProvider : BlobProviderBase, ITransientDependency public class AliyunBlobProvider : BlobProviderBase, ITransientDependency
{ {
protected IOssClientFactory OssClientFactory { get; } protected IOssClientFactory OssClientFactory { get; }
@ -92,8 +95,7 @@ namespace LINGYUN.Abp.BlobStoring.Aliyun
protected async virtual Task<IOss> GetOssClientAsync(BlobProviderArgs args) protected async virtual Task<IOss> GetOssClientAsync(BlobProviderArgs args)
{ {
var configuration = args.Configuration.GetAliyunConfiguration(); var ossClient = await OssClientFactory.CreateAsync();
var ossClient = await OssClientFactory.CreateAsync(configuration);
return ossClient; return ossClient;
} }

11
aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs

@ -6,17 +6,6 @@ namespace LINGYUN.Abp.BlobStoring.Aliyun
{ {
public class AliyunBlobProviderConfiguration public class AliyunBlobProviderConfiguration
{ {
/// <summary>
/// 数据中心
/// </summary>
/// <remarks>
/// 详见 https://help.aliyun.com/document_detail/31837.html?spm=a2c4g.11186623.2.14.417cd47eLc9LHc#concept-zt4-cvy-5db
/// </remarks>
public string Endpoint
{
get => _containerConfiguration.GetConfiguration<string>(AliyunBlobProviderConfigurationNames.Endpoint);
set => _containerConfiguration.SetConfiguration(AliyunBlobProviderConfigurationNames.Endpoint, Check.NotNullOrWhiteSpace(value, nameof(value)));
}
/// <summary> /// <summary>
/// 命名空间 /// 命名空间
/// </summary> /// </summary>

8
aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/IOssClientFactory.cs

@ -9,12 +9,6 @@ namespace LINGYUN.Abp.BlobStoring.Aliyun
/// 构建Oss客户端 /// 构建Oss客户端
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task<IOss> CreateAsync<TContainer>(); Task<IOss> CreateAsync();
/// <summary>
/// 通过配置信息构建Oss客户端调用
/// </summary>
/// <param name="configuration"></param>
/// <returns></returns>
Task<IOss> CreateAsync(AliyunBlobProviderConfiguration configuration);
} }
} }

25
aspnet-core/framework/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/OssClientFactory.cs

@ -1,59 +1,46 @@
using Aliyun.OSS; using Aliyun.OSS;
using LINGYUN.Abp.Aliyun; using LINGYUN.Abp.Aliyun;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Settings; using Volo.Abp.Settings;
namespace LINGYUN.Abp.BlobStoring.Aliyun namespace LINGYUN.Abp.BlobStoring.Aliyun
{ {
public class OssClientFactory : AliyunClientFactory<IOss, AliyunBlobProviderConfiguration>, IOssClientFactory, ITransientDependency public class OssClientFactory : AliyunClientFactory<IOss>, IOssClientFactory, ITransientDependency
{ {
protected IBlobContainerConfigurationProvider ConfigurationProvider { get; }
public OssClientFactory( public OssClientFactory(
ISettingProvider settingProvider, ISettingProvider settingProvider,
IBlobContainerConfigurationProvider configurationProvider,
IDistributedCache<AliyunBasicSessionCredentialsCacheItem> cache) IDistributedCache<AliyunBasicSessionCredentialsCacheItem> cache)
: base(settingProvider, cache) : base(settingProvider, cache)
{ {
ConfigurationProvider = configurationProvider;
}
public async virtual Task<IOss> CreateAsync<TContainer>()
{
var configuration = ConfigurationProvider.Get<TContainer>();
return await CreateAsync(configuration.GetAliyunConfiguration());
} }
/// <summary> /// <summary>
/// 普通方式构建Oss客户端 /// 普通方式构建Oss客户端
/// </summary> /// </summary>
/// <param name="configuration"></param>
/// <param name="regionId"></param> /// <param name="regionId"></param>
/// <param name="accessKeyId"></param> /// <param name="accessKeyId"></param>
/// <param name="accessKeySecret"></param> /// <param name="accessKeySecret"></param>
/// <returns></returns> /// <returns></returns>
protected override IOss GetClient(AliyunBlobProviderConfiguration configuration, string regionId, string accessKeyId, string accessKeySecret) protected override IOss GetClient(string regionId, string accessKeyId, string accessKeySecret)
{ {
return new OssClient( return new OssClient(
configuration.Endpoint, regionId,
accessKeyId, accessKeyId,
accessKeySecret); accessKeySecret);
} }
/// <summary> /// <summary>
/// 通过用户安全令牌构建Oss客户端 /// 通过用户安全令牌构建Oss客户端
/// </summary> /// </summary>
/// <param name="configuration"></param>
/// <param name="regionId"></param> /// <param name="regionId"></param>
/// <param name="accessKeyId"></param> /// <param name="accessKeyId"></param>
/// <param name="accessKeySecret"></param> /// <param name="accessKeySecret"></param>
/// <param name="securityToken"></param> /// <param name="securityToken"></param>
/// <returns></returns> /// <returns></returns>
protected override IOss GetSecurityTokenClient(AliyunBlobProviderConfiguration configuration, string regionId, string accessKeyId, string accessKeySecret, string securityToken) protected override IOss GetSecurityTokenClient(string regionId, string accessKeyId, string accessKeySecret, string securityToken)
{ {
return new OssClient( return new OssClient(
configuration.Endpoint, regionId,
accessKeyId, accessKeyId,
accessKeySecret, accessKeySecret,
securityToken); securityToken);

10
aspnet-core/framework/common/LINGYUN.Abp.Sms.Aliyun/LINGYUN/Abp/Sms/Aliyun/AliyunSmsSender.cs

@ -2,7 +2,9 @@
using Aliyun.Acs.Core.Exceptions; using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Http; using Aliyun.Acs.Core.Http;
using LINGYUN.Abp.Aliyun; using LINGYUN.Abp.Aliyun;
using LINGYUN.Abp.Aliyun.Features;
using LINGYUN.Abp.Aliyun.Settings; using LINGYUN.Abp.Aliyun.Settings;
using LINGYUN.Abp.Features.LimitValidation;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System; using System;
using System.Linq; using System.Linq;
@ -10,6 +12,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Features;
using Volo.Abp.Json; using Volo.Abp.Json;
using Volo.Abp.Settings; using Volo.Abp.Settings;
using Volo.Abp.Sms; using Volo.Abp.Sms;
@ -18,6 +21,7 @@ namespace LINGYUN.Abp.Sms.Aliyun
{ {
[Dependency(ServiceLifetime.Singleton)] [Dependency(ServiceLifetime.Singleton)]
[ExposeServices(typeof(ISmsSender), typeof(AliyunSmsSender))] [ExposeServices(typeof(ISmsSender), typeof(AliyunSmsSender))]
[RequiresFeature(AliyunFeatureNames.Sms.Enable)]
public class AliyunSmsSender : ISmsSender public class AliyunSmsSender : ISmsSender
{ {
protected IJsonSerializer JsonSerializer { get; } protected IJsonSerializer JsonSerializer { get; }
@ -36,6 +40,12 @@ namespace LINGYUN.Abp.Sms.Aliyun
AcsClientFactory = acsClientFactory; AcsClientFactory = acsClientFactory;
} }
[RequiresLimitFeature(
AliyunFeatureNames.Sms.SendLimit,
AliyunFeatureNames.Sms.SendLimitInterval,
LimitPolicy.Month,
AliyunFeatureNames.Sms.DefaultSendLimit,
AliyunFeatureNames.Sms.DefaultSendLimitInterval)]
public async virtual Task SendAsync(SmsMessage smsMessage) public async virtual Task SendAsync(SmsMessage smsMessage)
{ {
var domain = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.Domain); var domain = await SettingProvider.GetOrNullAsync(AliyunSettingNames.Sms.Domain);

84
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.Authorization/LINGYUN/Abp/OpenApi/Authorization/OpenApiAuthorizationService.cs

@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -27,17 +26,23 @@ namespace LINGYUN.Abp.OpenApi.Authorization
private readonly AbpOpenApiOptions _openApiOptions; private readonly AbpOpenApiOptions _openApiOptions;
private readonly ICurrentClient _currentClient; private readonly ICurrentClient _currentClient;
private readonly IWebClientInfoProvider _clientInfoProvider; private readonly IWebClientInfoProvider _clientInfoProvider;
private readonly IClientChecker _clientChecker;
private readonly IIpAddressChecker _ipAddressChecker;
private readonly AbpExceptionHandlingOptions _exceptionHandlingOptions; private readonly AbpExceptionHandlingOptions _exceptionHandlingOptions;
public OpenApiAuthorizationService( public OpenApiAuthorizationService(
IAppKeyStore appKeyStore, IAppKeyStore appKeyStore,
ICurrentClient currentClient, ICurrentClient currentClient,
IClientChecker clientChecker,
IIpAddressChecker ipAddressChecker,
IWebClientInfoProvider clientInfoProvider, IWebClientInfoProvider clientInfoProvider,
IOptionsMonitor<AbpOpenApiOptions> options, IOptionsMonitor<AbpOpenApiOptions> options,
IOptions<AbpExceptionHandlingOptions> exceptionHandlingOptions) IOptions<AbpExceptionHandlingOptions> exceptionHandlingOptions)
{ {
_appKeyStore = appKeyStore; _appKeyStore = appKeyStore;
_currentClient = currentClient; _currentClient = currentClient;
_clientChecker = clientChecker;
_ipAddressChecker = ipAddressChecker;
_clientInfoProvider = clientInfoProvider; _clientInfoProvider = clientInfoProvider;
_openApiOptions = options.CurrentValue; _openApiOptions = options.CurrentValue;
_exceptionHandlingOptions = exceptionHandlingOptions.Value; _exceptionHandlingOptions = exceptionHandlingOptions.Value;
@ -50,37 +55,72 @@ namespace LINGYUN.Abp.OpenApi.Authorization
return true; return true;
} }
// TODO: 不够优雅,应该用接口来实现 if (!await ValidateClient(httpContext))
//if (_currentClient.IsAuthenticated && {
// _openApiOptions.HasWhiteClient(_currentClient.Id)) return false;
//{ }
// return true;
//} if (!await ValidateQueryString(httpContext))
{
return false;
}
if (!await ValidatAppDescriptor(httpContext))
{
return false;
}
return true;
}
protected async virtual Task<bool> ValidateClient(HttpContext httpContext)
{
if (_currentClient.IsAuthenticated && !await _clientChecker.IsGrantAsync(_currentClient.Id, httpContext.RequestAborted))
{
var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithClientId,
$"Client Id {_currentClient.Id} Not Allowed",
$"Client Id {_currentClient.Id} Not Allowed");
await Unauthorized(httpContext, exception);
return false;
}
//if (!string.IsNullOrWhiteSpace(_clientInfoProvider.ClientIpAddress) && if (!string.IsNullOrWhiteSpace(_clientInfoProvider.ClientIpAddress) &&
// _openApiOptions.HasWhiteIpAddress(_clientInfoProvider.ClientIpAddress)) !await _ipAddressChecker.IsGrantAsync(_clientInfoProvider.ClientIpAddress, httpContext.RequestAborted))
//{ {
// return true; var exception = new BusinessException(
//} AbpOpenApiConsts.InvalidAccessWithIpAddress,
$"Client IpAddress {_clientInfoProvider.ClientIpAddress} Not Allowed",
$"Client IpAddress {_clientInfoProvider.ClientIpAddress} Not Allowed");
await Unauthorized(httpContext, exception);
return false;
}
return true;
}
BusinessException exception; protected async virtual Task<bool> ValidateQueryString(HttpContext httpContext)
{
if (!httpContext.Request.QueryString.HasValue) if (!httpContext.Request.QueryString.HasValue)
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithAppKeyNotFound, AbpOpenApiConsts.InvalidAccessWithAppKeyNotFound,
$"{AbpOpenApiConsts.AppKeyFieldName} Not Found", $"{AbpOpenApiConsts.AppKeyFieldName} Not Found",
$"{AbpOpenApiConsts.AppKeyFieldName} Not Found"); $"{AbpOpenApiConsts.AppKeyFieldName} Not Found");
await Unauthorized(httpContext, exception); await Unauthorized(httpContext, exception);
return false; return false;
} }
return true;
}
protected async virtual Task<bool> ValidatAppDescriptor(HttpContext httpContext)
{
httpContext.Request.Query.TryGetValue(AbpOpenApiConsts.AppKeyFieldName, out var appKey); httpContext.Request.Query.TryGetValue(AbpOpenApiConsts.AppKeyFieldName, out var appKey);
httpContext.Request.Query.TryGetValue(AbpOpenApiConsts.SignatureFieldName, out var sign); httpContext.Request.Query.TryGetValue(AbpOpenApiConsts.SignatureFieldName, out var sign);
httpContext.Request.Query.TryGetValue(AbpOpenApiConsts.TimeStampFieldName, out var timeStampString); httpContext.Request.Query.TryGetValue(AbpOpenApiConsts.TimeStampFieldName, out var timeStampString);
if (StringValues.IsNullOrEmpty(appKey)) if (StringValues.IsNullOrEmpty(appKey))
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithAppKeyNotFound, AbpOpenApiConsts.InvalidAccessWithAppKeyNotFound,
$"{AbpOpenApiConsts.AppKeyFieldName} Not Found", $"{AbpOpenApiConsts.AppKeyFieldName} Not Found",
$"{AbpOpenApiConsts.AppKeyFieldName} Not Found"); $"{AbpOpenApiConsts.AppKeyFieldName} Not Found");
@ -90,7 +130,7 @@ namespace LINGYUN.Abp.OpenApi.Authorization
if (StringValues.IsNullOrEmpty(sign)) if (StringValues.IsNullOrEmpty(sign))
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithSignNotFound, AbpOpenApiConsts.InvalidAccessWithSignNotFound,
$"{AbpOpenApiConsts.SignatureFieldName} Not Found", $"{AbpOpenApiConsts.SignatureFieldName} Not Found",
$"{AbpOpenApiConsts.SignatureFieldName} Not Found"); $"{AbpOpenApiConsts.SignatureFieldName} Not Found");
@ -101,7 +141,7 @@ namespace LINGYUN.Abp.OpenApi.Authorization
if (StringValues.IsNullOrEmpty(timeStampString)) if (StringValues.IsNullOrEmpty(timeStampString))
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithTimestampNotFound, AbpOpenApiConsts.InvalidAccessWithTimestampNotFound,
$"{AbpOpenApiConsts.TimeStampFieldName} Not Found", $"{AbpOpenApiConsts.TimeStampFieldName} Not Found",
$"{AbpOpenApiConsts.TimeStampFieldName} Not Found"); $"{AbpOpenApiConsts.TimeStampFieldName} Not Found");
@ -112,7 +152,7 @@ namespace LINGYUN.Abp.OpenApi.Authorization
if (!long.TryParse(timeStampString.ToString(), out long timeStamp)) if (!long.TryParse(timeStampString.ToString(), out long timeStamp))
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithTimestamp, AbpOpenApiConsts.InvalidAccessWithTimestamp,
"invalid timestamp", "invalid timestamp",
"invalid timestamp"); "invalid timestamp");
@ -121,10 +161,10 @@ namespace LINGYUN.Abp.OpenApi.Authorization
return false; return false;
} }
var appDescriptor = await _appKeyStore.FindAsync(appKey.ToString()); var appDescriptor = await _appKeyStore.FindAsync(appKey.ToString(), httpContext.RequestAborted);
if (appDescriptor == null) if (appDescriptor == null)
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithAppKey, AbpOpenApiConsts.InvalidAccessWithAppKey,
"invalid appKey", "invalid appKey",
"invalid appKey") "invalid appKey")
@ -148,7 +188,7 @@ namespace LINGYUN.Abp.OpenApi.Authorization
var requiredSign = CalculationSignature(httpContext.Request.Path.Value, queryDictionary); var requiredSign = CalculationSignature(httpContext.Request.Path.Value, queryDictionary);
if (!string.Equals(requiredSign, sign.ToString())) if (!string.Equals(requiredSign, sign.ToString()))
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithSign, AbpOpenApiConsts.InvalidAccessWithSign,
"invalid signature", "invalid signature",
"invalid signature"); "invalid signature");
@ -163,7 +203,7 @@ namespace LINGYUN.Abp.OpenApi.Authorization
if ((now - timeStamp) / 1000 > appDescriptor.SignLifetime.Value) if ((now - timeStamp) / 1000 > appDescriptor.SignLifetime.Value)
{ {
exception = new BusinessException( var exception = new BusinessException(
AbpOpenApiConsts.InvalidAccessWithTimestamp, AbpOpenApiConsts.InvalidAccessWithTimestamp,
"session timed out or expired", "session timed out or expired",
"session timed out or expired"); "session timed out or expired");

3
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/LINGYUN.Abp.OpenApi.IdentityServer.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.IdentityServer.Domain" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.OpenApi\LINGYUN.Abp.OpenApi.csproj" />
</ItemGroup>
</Project>

11
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/LINGYUN/Abp/OpenApi/IdentityServer/AbpOpenApiIdentityServerModule.cs

@ -0,0 +1,11 @@
using Volo.Abp.IdentityServer;
using Volo.Abp.Modularity;
namespace LINGYUN.Abp.OpenApi.IdentityServer;
[DependsOn(
typeof(AbpOpenApiModule),
typeof(AbpIdentityServerDomainModule))]
public class AbpOpenApiIdentityServerModule : AbpModule
{
}

70
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.IdentityServer/LINGYUN/Abp/OpenApi/IdentityServer/IdentityServerAppKeyStore.cs

@ -0,0 +1,70 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.OpenApi.IdentityServer;
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
public class IdentityServerAppKeyStore : IAppKeyStore, ITransientDependency
{
public ILogger<IdentityServerAppKeyStore> Logger { protected get; set; }
private readonly IGuidGenerator _guidGenerator;
private readonly IClientRepository _clientRepository;
public IdentityServerAppKeyStore(
IGuidGenerator guidGenerator,
IClientRepository clientRepository)
{
_guidGenerator = guidGenerator;
_clientRepository = clientRepository;
Logger = NullLogger<IdentityServerAppKeyStore>.Instance;
}
public async virtual Task<AppDescriptor> FindAsync(string appKey, CancellationToken cancellationToken = default)
{
var client = await _clientRepository.FindByClientIdAsync(appKey, cancellationToken: cancellationToken);
if (client != null)
{
int? signLifeTime = null;
var appSecret = client.FindSecret(nameof(AppDescriptor.AppSecret));
if (appSecret == null)
{
Logger.LogWarning("Found a client {ClientId} that meets the criteria, but did not specify the client key [AppSecret]", client.ClientId);
return null;
}
var signLifeTimeProp = client.FindProperty(nameof(AppDescriptor.SignLifetime));
if (signLifeTimeProp != null && int.TryParse(signLifeTimeProp.Value, out var time))
{
signLifeTime = time;
}
return new AppDescriptor(client.ClientName, client.ClientId, appSecret.Value, signLifeTime: signLifeTime);
}
return null;
}
public async virtual Task StoreAsync(AppDescriptor descriptor, CancellationToken cancellationToken = default)
{
var client = new Client(_guidGenerator.Create(), descriptor.AppKey)
{
ClientName = descriptor.AppName,
};
client.AddSecret(descriptor.AppSecret);
if (descriptor.SignLifetime.HasValue)
{
client.AddProperty(nameof(AppDescriptor.SignLifetime), descriptor.SignLifetime.Value.ToString());
}
await _clientRepository.InsertAsync(client, cancellationToken: cancellationToken);
}
}

3
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

19
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/LINGYUN.Abp.OpenApi.OpenIddict.csproj

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.OpenIddict.Domain" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.OpenApi\LINGYUN.Abp.OpenApi.csproj" />
</ItemGroup>
</Project>

11
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/LINGYUN/Abp/OpenApi/OpenIddict/AbpOpenApiOpenIddictModule.cs

@ -0,0 +1,11 @@
using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict;
namespace LINGYUN.Abp.OpenApi.OpenIddict;
[DependsOn(
typeof(AbpOpenApiModule),
typeof(AbpOpenIddictDomainModule))]
public class AbpOpenApiOpenIddictModule : AbpModule
{
}

59
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi.OpenIddict/LINGYUN/Abp/OpenApi/OpenIddict/OpenIddictAppKeyStore.cs

@ -0,0 +1,59 @@
using Microsoft.Extensions.DependencyInjection;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.OpenIddict.Applications;
namespace LINGYUN.Abp.OpenApi.OpenIddict;
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
public class OpenIddictAppKeyStore : IAppKeyStore, ITransientDependency
{
private readonly IAbpOpenIdApplicationStore _appStore;
private readonly IGuidGenerator _guidGenerator;
public OpenIddictAppKeyStore(
IAbpOpenIdApplicationStore appStore,
IGuidGenerator guidGenerator)
{
_appStore = appStore;
_guidGenerator = guidGenerator;
}
public async virtual Task<AppDescriptor> FindAsync(string appKey, CancellationToken cancellationToken = default)
{
var application = await _appStore.FindByClientIdAsync(appKey, cancellationToken);
if (application != null)
{
int? signLifeTime = null;
var signLifeTimeProp = application.GetProperty(nameof(AppDescriptor.SignLifetime));
if (signLifeTimeProp != null && int.TryParse(signLifeTimeProp.ToString(), out var time))
{
signLifeTime = time;
}
return new AppDescriptor(application.DisplayName, application.ClientId, application.ClientSecret, signLifeTime: signLifeTime);
}
return null;
}
public async virtual Task StoreAsync(AppDescriptor descriptor, CancellationToken cancellationToken = default)
{
var application = new OpenIddictApplicationModel
{
Id = _guidGenerator.Create(),
ClientId = descriptor.AppKey,
ClientSecret = descriptor.AppSecret,
DisplayName = descriptor.AppName,
};
if (descriptor.SignLifetime.HasValue)
{
application.SetProperty(nameof(AppDescriptor.SignLifetime), descriptor.SignLifetime);
}
await _appStore.CreateAsync(application, cancellationToken);
}
}

3
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/AbpOpenApiConsts.cs

@ -18,5 +18,8 @@
public const string InvalidAccessWithTimestamp = KeyPrefix + ":9210"; public const string InvalidAccessWithTimestamp = KeyPrefix + ":9210";
public const string InvalidAccessWithTimestampNotFound = KeyPrefix + ":9211"; public const string InvalidAccessWithTimestampNotFound = KeyPrefix + ":9211";
public const string InvalidAccessWithClientId = KeyPrefix + ":9300";
public const string InvalidAccessWithIpAddress = KeyPrefix + ":9400";
} }
} }

15
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/AlwaysAllowClientChecker.cs

@ -0,0 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.OpenApi;
[Dependency(ServiceLifetime.Singleton, TryRegister = true)]
public class AlwaysAllowClientChecker : IClientChecker
{
public Task<bool> IsGrantAsync(string clientId, CancellationToken cancellationToken = default)
{
return Task.FromResult(true);
}
}

15
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/AlwaysAllowIpAddressChecker.cs

@ -0,0 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.OpenApi;
[Dependency(ServiceLifetime.Singleton, TryRegister = true)]
public class AlwaysAllowIpAddressChecker : IIpAddressChecker
{
public Task<bool> IsGrantAsync(string ipAddress, CancellationToken cancellationToken = default)
{
return Task.FromResult(true);
}
}

10
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/ConfigurationStore/DefaultAppKeyStore.cs

@ -1,5 +1,7 @@
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -15,7 +17,7 @@ namespace LINGYUN.Abp.OpenApi.ConfigurationStore
_options = options.CurrentValue; _options = options.CurrentValue;
} }
public Task<AppDescriptor> FindAsync(string appKey) public Task<AppDescriptor> FindAsync(string appKey, CancellationToken cancellationToken = default)
{ {
return Task.FromResult(Find(appKey)); return Task.FromResult(Find(appKey));
} }
@ -24,5 +26,11 @@ namespace LINGYUN.Abp.OpenApi.ConfigurationStore
{ {
return _options.AppDescriptors?.FirstOrDefault(t => t.AppKey == appKey); return _options.AppDescriptors?.FirstOrDefault(t => t.AppKey == appKey);
} }
public Task StoreAsync(AppDescriptor descriptor, CancellationToken cancellationToken = default)
{
_options.AppDescriptors.AddIfNotContains(descriptor);
return Task.CompletedTask;
}
} }
} }

14
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/IAppKeyStore.cs

@ -1,9 +1,11 @@
using System.Threading.Tasks; using System.Threading;
using System.Threading.Tasks;
namespace LINGYUN.Abp.OpenApi namespace LINGYUN.Abp.OpenApi;
public interface IAppKeyStore
{ {
public interface IAppKeyStore Task<AppDescriptor> FindAsync(string appKey, CancellationToken cancellationToken = default);
{
Task<AppDescriptor> FindAsync(string appKey); Task StoreAsync(AppDescriptor descriptor, CancellationToken cancellationToken = default);
}
} }

9
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/IClientChecker.cs

@ -0,0 +1,9 @@
using System.Threading;
using System.Threading.Tasks;
namespace LINGYUN.Abp.OpenApi;
public interface IClientChecker
{
Task<bool> IsGrantAsync(string clientId, CancellationToken cancellationToken = default);
}

8
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/IIpAddressChecker.cs

@ -0,0 +1,8 @@
using System.Threading;
using System.Threading.Tasks;
namespace LINGYUN.Abp.OpenApi;
public interface IIpAddressChecker
{
Task<bool> IsGrantAsync(string ipAddress, CancellationToken cancellationToken = default);
}

4
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/Localization/Resources/en.json

@ -6,6 +6,8 @@
"AbpOpenApi:9110": "Invalid sign.", "AbpOpenApi:9110": "Invalid sign.",
"AbpOpenApi:9111": "sign not found.", "AbpOpenApi:9111": "sign not found.",
"AbpOpenApi:9210": "Request timed out or the session expired.", "AbpOpenApi:9210": "Request timed out or the session expired.",
"AbpOpenApi:9211": "timestamp not found." "AbpOpenApi:9211": "timestamp not found.",
"AbpOpenApi:9300": "The client is not within the allowed range.",
"AbpOpenApi:9400": "The client IP is not within the allowed range."
} }
} }

4
aspnet-core/framework/open-api/LINGYUN.Abp.OpenApi/LINGYUN/Abp/OpenApi/Localization/Resources/zh-Hans.json

@ -6,6 +6,8 @@
"AbpOpenApi:9110": "无效的签名 sign.", "AbpOpenApi:9110": "无效的签名 sign.",
"AbpOpenApi:9111": "未携带签名(sign).", "AbpOpenApi:9111": "未携带签名(sign).",
"AbpOpenApi:9210": "请求超时或会话已过期.", "AbpOpenApi:9210": "请求超时或会话已过期.",
"AbpOpenApi:9211": "未携带时间戳标识." "AbpOpenApi:9211": "未携带时间戳标识.",
"AbpOpenApi:9300": "客户端不在允许的范围内.",
"AbpOpenApi:9400": "客户端IP不在允许的范围内."
} }
} }

8
aspnet-core/framework/pushplus/LINGYUN.Abp.PushPlus.SettingManagement/LINGYUN/Abp/PushPlus/SettingManagement/PushPlusSettingAppService.cs

@ -7,16 +7,17 @@ using Volo.Abp.Authorization.Permissions;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.SettingManagement; using Volo.Abp.SettingManagement;
using Volo.Abp.Settings; using Volo.Abp.Settings;
using LINGYUN.Abp.PushPlus.Features;
namespace LINGYUN.Abp.PushPlus.SettingManagement namespace LINGYUN.Abp.PushPlus.SettingManagement
{ {
public class WxPusherSettingAppService : ApplicationService, IPushPlusSettingAppService public class PushPlusSettingAppService : ApplicationService, IPushPlusSettingAppService
{ {
protected ISettingManager SettingManager { get; } protected ISettingManager SettingManager { get; }
protected IPermissionChecker PermissionChecker { get; } protected IPermissionChecker PermissionChecker { get; }
protected ISettingDefinitionManager SettingDefinitionManager { get; } protected ISettingDefinitionManager SettingDefinitionManager { get; }
public WxPusherSettingAppService( public PushPlusSettingAppService(
ISettingManager settingManager, ISettingManager settingManager,
IPermissionChecker permissionChecker, IPermissionChecker permissionChecker,
ISettingDefinitionManager settingDefinitionManager) ISettingDefinitionManager settingDefinitionManager)
@ -42,7 +43,8 @@ namespace LINGYUN.Abp.PushPlus.SettingManagement
var settingGroups = new SettingGroupResult(); var settingGroups = new SettingGroupResult();
var pushPlusSettingGroup = new SettingGroupDto(L["DisplayName:PushPlus"], L["Description:PushPlus"]); var pushPlusSettingGroup = new SettingGroupDto(L["DisplayName:PushPlus"], L["Description:PushPlus"]);
if (await PermissionChecker.IsGrantedAsync(PushPlusSettingPermissionNames.ManageSetting)) if (await FeatureChecker.IsEnabledAsync(PushPlusFeatureNames.Message.Enable) &&
await PermissionChecker.IsGrantedAsync(PushPlusSettingPermissionNames.ManageSetting))
{ {
var securitySetting = pushPlusSettingGroup.AddSetting(L["Security"], L["Security"]); var securitySetting = pushPlusSettingGroup.AddSetting(L["Security"], L["Security"]);
securitySetting.AddDetail( securitySetting.AddDetail(

4
aspnet-core/framework/pushplus/LINGYUN.Abp.PushPlus.SettingManagement/LINGYUN/Abp/PushPlus/SettingManagement/PushPlusSettingController.cs

@ -9,11 +9,11 @@ namespace LINGYUN.Abp.PushPlus.SettingManagement
[RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)] [RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)]
[Area(AbpSettingManagementRemoteServiceConsts.ModuleName)] [Area(AbpSettingManagementRemoteServiceConsts.ModuleName)]
[Route($"api/{AbpSettingManagementRemoteServiceConsts.ModuleName}/push-plus")] [Route($"api/{AbpSettingManagementRemoteServiceConsts.ModuleName}/push-plus")]
public class WxPusherSettingController : AbpControllerBase, IPushPlusSettingAppService public class PushPlusSettingController : AbpControllerBase, IPushPlusSettingAppService
{ {
protected IPushPlusSettingAppService Service { get; } protected IPushPlusSettingAppService Service { get; }
public WxPusherSettingController( public PushPlusSettingController(
IPushPlusSettingAppService service) IPushPlusSettingAppService service)
{ {
Service = service; Service = service;

12
aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.SettingManagement/LINGYUN/Abp/WeChat/SettingManagement/WeChatSettingAppService.cs

@ -1,8 +1,11 @@
using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.WeChat.Localization; using LINGYUN.Abp.WeChat.Localization;
using LINGYUN.Abp.WeChat.MiniProgram.Features;
using LINGYUN.Abp.WeChat.MiniProgram.Settings; using LINGYUN.Abp.WeChat.MiniProgram.Settings;
using LINGYUN.Abp.WeChat.Official.Features;
using LINGYUN.Abp.WeChat.Official.Settings; using LINGYUN.Abp.WeChat.Official.Settings;
using LINGYUN.Abp.WeChat.Settings; using LINGYUN.Abp.WeChat.Settings;
using LINGYUN.Abp.WeChat.Work.Features;
using LINGYUN.Abp.WeChat.Work.Settings; using LINGYUN.Abp.WeChat.Work.Settings;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
@ -54,7 +57,8 @@ namespace LINGYUN.Abp.WeChat.SettingManagement
providerName); providerName);
// 无权限返回空结果,直接报错的话,网关聚合会抛出异常 // 无权限返回空结果,直接报错的话,网关聚合会抛出异常
if (await PermissionChecker.IsGrantedAsync(WeChatSettingPermissionNames.Official)) if (await FeatureChecker.IsEnabledAsync(WeChatOfficialFeatures.Enable) &&
await PermissionChecker.IsGrantedAsync(WeChatSettingPermissionNames.Official))
{ {
#region 公众号 #region 公众号
@ -99,7 +103,8 @@ namespace LINGYUN.Abp.WeChat.SettingManagement
#endregion #endregion
} }
if (await PermissionChecker.IsGrantedAsync(WeChatSettingPermissionNames.MiniProgram)) if (await FeatureChecker.IsEnabledAsync(WeChatMiniProgramFeatures.Enable) &&
await PermissionChecker.IsGrantedAsync(WeChatSettingPermissionNames.MiniProgram))
{ {
#region 小程序 #region 小程序
@ -134,7 +139,8 @@ namespace LINGYUN.Abp.WeChat.SettingManagement
settingGroups.AddGroup(wechatSettingGroup); settingGroups.AddGroup(wechatSettingGroup);
if (await PermissionChecker.IsGrantedAsync(WeChatSettingPermissionNames.Work)) if (await FeatureChecker.IsEnabledAsync(WeChatWorkFeatureNames.Enable) &&
await PermissionChecker.IsGrantedAsync(WeChatSettingPermissionNames.Work))
{ {
#region 企业微信 #region 企业微信
var wechatWorkSettingGroup = new SettingGroupDto(L["DisplayName:WeChatWork"], L["Description:WeChatWork"]); var wechatWorkSettingGroup = new SettingGroupDto(L["DisplayName:WeChatWork"], L["Description:WeChatWork"]);

4
aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher.SettingManagement/LINGYUN/Abp/WxPusher/SettingManagement/WxPusherSettingAppService.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.WxPusher.Features;
using LINGYUN.Abp.WxPusher.Localization; using LINGYUN.Abp.WxPusher.Localization;
using LINGYUN.Abp.WxPusher.Settings; using LINGYUN.Abp.WxPusher.Settings;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -42,7 +43,8 @@ namespace LINGYUN.Abp.WxPusher.SettingManagement
var settingGroups = new SettingGroupResult(); var settingGroups = new SettingGroupResult();
var wxPusherSettingGroup = new SettingGroupDto(L["DisplayName:WxPusher"], L["Description:WxPusher"]); var wxPusherSettingGroup = new SettingGroupDto(L["DisplayName:WxPusher"], L["Description:WxPusher"]);
if (await PermissionChecker.IsGrantedAsync(WxPusherSettingPermissionNames.ManageSetting)) if (await FeatureChecker.IsEnabledAsync(WxPusherFeatureNames.Enable) &&
await PermissionChecker.IsGrantedAsync(WxPusherSettingPermissionNames.ManageSetting))
{ {
var securitySetting = wxPusherSettingGroup.AddSetting(L["Security"], L["Security"]); var securitySetting = wxPusherSettingGroup.AddSetting(L["Security"], L["Security"]);
securitySetting.AddDetail( securitySetting.AddDetail(

1
aspnet-core/framework/wx-pusher/LINGYUN.Abp.WxPusher/LINGYUN.Abp.WxPusher.csproj

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" /> <Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" /> <Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" /> <Import Project="..\..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>

938
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20240527092536_Remote-Tenant-Id-With-Text-Template.Designer.cs

@ -0,0 +1,938 @@
// <auto-generated />
using System;
using LY.MicroService.BackendAdmin.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace LY.MicroService.BackendAdmin.EntityFrameworkCore.Migrations
{
[DbContext(typeof(BackendAdminMigrationsDbContext))]
[Migration("20240527092536_Remote-Tenant-Id-With-Text-Template")]
partial class RemoteTenantIdWithTextTemplate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.EntityPropertyInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("DisplayName");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)")
.HasColumnName("Name");
b.Property<string>("TypeFullName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)")
.HasColumnName("TypeFullName");
b.Property<Guid>("TypeInfoId")
.HasColumnType("char(36)");
b.Property<string>("ValueRange")
.HasMaxLength(512)
.HasColumnType("varchar(512)")
.HasColumnName("ValueRange");
b.HasKey("Id");
b.HasIndex("TypeInfoId", "TypeFullName");
b.ToTable("AbpAuthEntityProperties", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.EntityTypeInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("DisplayName");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsAuditEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)")
.HasColumnName("Name");
b.Property<string>("TypeFullName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)")
.HasColumnName("TypeFullName");
b.HasKey("Id");
b.HasIndex("TypeFullName");
b.ToTable("AbpAuthEntitites", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.OrganizationUnitEntityRule", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("AllowProperties")
.HasMaxLength(512)
.HasColumnType("varchar(512)")
.HasColumnName("AllowProperties");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("EntityTypeFullName")
.HasColumnType("longtext");
b.Property<Guid>("EntityTypeId")
.HasColumnType("char(36)");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("FilterGroup")
.HasColumnType("longtext")
.HasColumnName("FilterGroup");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<int>("Operation")
.HasColumnType("int");
b.Property<string>("OrgCode")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("OrgCode");
b.Property<Guid>("OrgId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("EntityTypeId");
b.ToTable("AbpAuthOrganizationUnitEntityRules", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.RoleEntityRule", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("AllowProperties")
.HasMaxLength(512)
.HasColumnType("varchar(512)")
.HasColumnName("AllowProperties");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("EntityTypeFullName")
.HasColumnType("longtext");
b.Property<Guid>("EntityTypeId")
.HasColumnType("char(36)");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("FilterGroup")
.HasColumnType("longtext")
.HasColumnName("FilterGroup");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<int>("Operation")
.HasColumnType("int");
b.Property<Guid>("RoleId")
.HasColumnType("char(36)");
b.Property<string>("RoleName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)")
.HasColumnName("RoleName");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("EntityTypeId");
b.ToTable("AbpAuthRoleEntityRules", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Editions.Edition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.HasKey("Id");
b.HasIndex("DisplayName");
b.ToTable("AbpEditions", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<DateTime?>("DisableTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("EditionId")
.HasColumnType("char(36)");
b.Property<DateTime?>("EnableTime")
.HasColumnType("datetime(6)");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("NormalizedName")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.HasKey("Id");
b.HasIndex("EditionId");
b.HasIndex("Name");
b.HasIndex("NormalizedName");
b.ToTable("AbpTenants", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b =>
{
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.HasKey("TenantId", "Name");
b.ToTable("AbpTenantConnectionStrings", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplate", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Content")
.HasMaxLength(1048576)
.HasColumnType("longtext")
.HasColumnName("Content");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Culture")
.HasMaxLength(30)
.HasColumnType("varchar(30)")
.HasColumnName("Culture");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("DisplayName");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnName("Name");
b.HasKey("Id");
b.HasIndex("Name")
.HasDatabaseName("IX_Tenant_Text_Template_Name");
b.ToTable("AbpTextTemplates", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplateDefinition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("DefaultCultureName")
.HasMaxLength(30)
.HasColumnType("varchar(30)")
.HasColumnName("DefaultCultureName");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("varchar(512)")
.HasColumnName("DisplayName");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsInlineLocalized")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsLayout")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsStatic")
.HasColumnType("tinyint(1)");
b.Property<string>("Layout")
.HasMaxLength(60)
.HasColumnType("varchar(60)")
.HasColumnName("Layout");
b.Property<string>("LocalizationResourceName")
.HasMaxLength(64)
.HasColumnType("varchar(64)")
.HasColumnName("LocalizationResourceName");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasColumnName("Name");
b.Property<string>("RenderEngine")
.HasMaxLength(30)
.HasColumnType("varchar(30)")
.HasColumnName("RenderEngine");
b.HasKey("Id");
b.ToTable("AbpTextTemplateDefinitions", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("AllowedProviders")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("DefaultValue")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("Description")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<bool>("IsAvailableToHost")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsVisibleToClients")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ValueType")
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatures", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpFeatureGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ProviderName")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey")
.IsUnique();
b.ToTable("AbpFeatureValues", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<byte>("MultiTenancySide")
.HasColumnType("tinyint unsigned");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ParentName")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Providers")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("StateCheckers")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("GroupName");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissions", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ProviderName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey")
.IsUnique();
b.ToTable("AbpPermissionGrants", (string)null);
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpPermissionGroups", (string)null);
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ProviderName")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey")
.IsUnique();
b.ToTable("AbpSettings", (string)null);
});
modelBuilder.Entity("Volo.Abp.SettingManagement.SettingDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("DefaultValue")
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.Property<string>("Description")
.HasMaxLength(512)
.HasColumnType("varchar(512)");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsEncrypted")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsInherited")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsVisibleToClients")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Providers")
.HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("AbpSettingDefinitions", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.EntityPropertyInfo", b =>
{
b.HasOne("LINGYUN.Abp.DataProtectionManagement.EntityTypeInfo", "TypeInfo")
.WithMany("Properties")
.HasForeignKey("TypeInfoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TypeInfo");
});
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.OrganizationUnitEntityRule", b =>
{
b.HasOne("LINGYUN.Abp.DataProtectionManagement.EntityTypeInfo", "EntityTypeInfo")
.WithMany()
.HasForeignKey("EntityTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EntityTypeInfo");
});
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.RoleEntityRule", b =>
{
b.HasOne("LINGYUN.Abp.DataProtectionManagement.EntityTypeInfo", "EntityTypeInfo")
.WithMany()
.HasForeignKey("EntityTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EntityTypeInfo");
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b =>
{
b.HasOne("LINGYUN.Abp.Saas.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId");
b.Navigation("Edition");
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b =>
{
b.HasOne("LINGYUN.Abp.Saas.Tenants.Tenant", null)
.WithMany("ConnectionStrings")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LINGYUN.Abp.DataProtectionManagement.EntityTypeInfo", b =>
{
b.Navigation("Properties");
});
modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b =>
{
b.Navigation("ConnectionStrings");
});
#pragma warning restore 612, 618
}
}
}

48
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/20240527092536_Remote-Tenant-Id-With-Text-Template.cs

@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.BackendAdmin.EntityFrameworkCore.Migrations
{
/// <inheritdoc />
public partial class RemoteTenantIdWithTextTemplate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Tenant_Text_Template_Name",
table: "AbpTextTemplates");
migrationBuilder.DropColumn(
name: "TenantId",
table: "AbpTextTemplates");
migrationBuilder.CreateIndex(
name: "IX_Tenant_Text_Template_Name",
table: "AbpTextTemplates",
column: "Name");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Tenant_Text_Template_Name",
table: "AbpTextTemplates");
migrationBuilder.AddColumn<Guid>(
name: "TenantId",
table: "AbpTextTemplates",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_Tenant_Text_Template_Name",
table: "AbpTextTemplates",
columns: new[] { "TenantId", "Name" });
}
}
}

6
aspnet-core/migrations/LY.MicroService.BackendAdmin.EntityFrameworkCore/Migrations/BackendAdminMigrationsDbContextModelSnapshot.cs

@ -481,13 +481,9 @@ namespace LY.MicroService.BackendAdmin.EntityFrameworkCore.Migrations
.HasColumnType("varchar(100)") .HasColumnType("varchar(100)")
.HasColumnName("Name"); .HasColumnName("Name");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId", "Name") b.HasIndex("Name")
.HasDatabaseName("IX_Tenant_Text_Template_Name"); .HasDatabaseName("IX_Tenant_Text_Template_Name");
b.ToTable("AbpTextTemplates", (string)null); b.ToTable("AbpTextTemplates", (string)null);

2
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat.Work/LINGYUN/Abp/IdentityServer/WeChat/Work/WeChatWorkGrantValidator.cs

@ -92,7 +92,7 @@ public class WeChatWorkGrantValidator : IExtensionGrantValidator
if (!await SettingProvider.IsTrueAsync("Abp.Account.IsSelfRegistrationEnabled") || if (!await SettingProvider.IsTrueAsync("Abp.Account.IsSelfRegistrationEnabled") ||
!await SettingProvider.IsTrueAsync(WeChatWorkSettingNames.EnabledQuickLogin)) !await SettingProvider.IsTrueAsync(WeChatWorkSettingNames.EnabledQuickLogin))
{ {
Logger.LogWarning("Invalid grant type: wechat work user not register", userInfo.UserId); Logger.LogWarning("Invalid grant type: wechat work user {userId} not register", userInfo.UserId);
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, WeChatWorkLocalizer["InvalidGrant:UserIdNotRegister"]); context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, WeChatWorkLocalizer["InvalidGrant:UserIdNotRegister"]);
return; return;

2
aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.WeChat.Work/LINGYUN/Abp/OpenIddict/WeChat/Work/WeChatWorkTokenExtensionGrant.cs

@ -77,7 +77,7 @@ public class WeChatWorkTokenExtensionGrant : ITokenExtensionGrant
if (!await settingProvider.IsTrueAsync("Abp.Account.IsSelfRegistrationEnabled") || if (!await settingProvider.IsTrueAsync("Abp.Account.IsSelfRegistrationEnabled") ||
!await settingProvider.IsTrueAsync(WeChatWorkSettingNames.EnabledQuickLogin)) !await settingProvider.IsTrueAsync(WeChatWorkSettingNames.EnabledQuickLogin))
{ {
logger.LogWarning("Invalid grant type: wechat work user not register", userInfo.UserId); logger.LogWarning("Invalid grant type: wechat work user {userId} not register", userInfo.UserId);
var properties = new AuthenticationProperties(new Dictionary<string, string> var properties = new AuthenticationProperties(new Dictionary<string, string>
{ {

2
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Aliyun/LINGYUN/Abp/OssManagement/Aliyun/AliyunOssContainer.cs

@ -396,7 +396,7 @@ namespace LINGYUN.Abp.OssManagement.Aliyun
protected async virtual Task<IOss> CreateClientAsync() protected async virtual Task<IOss> CreateClientAsync()
{ {
return await OssClientFactory.CreateAsync<AbpOssManagementContainer>(); return await OssClientFactory.CreateAsync();
} }
} }
} }

6
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.SettingManagement/LINGYUN/Abp/OssManagement/SettingManagement/OssManagementSettingAppService.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.OssManagement.Localization; using LINGYUN.Abp.OssManagement.Features;
using LINGYUN.Abp.OssManagement.Localization;
using LINGYUN.Abp.OssManagement.Permissions; using LINGYUN.Abp.OssManagement.Permissions;
using LINGYUN.Abp.OssManagement.Settings; using LINGYUN.Abp.OssManagement.Settings;
using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.SettingManagement;
@ -44,7 +45,8 @@ namespace LINGYUN.Abp.OssManagement.SettingManagement
var settingGroups = new SettingGroupResult(); var settingGroups = new SettingGroupResult();
// 无权限返回空结果,直接报错的话,网关聚合会抛出异常 // 无权限返回空结果,直接报错的话,网关聚合会抛出异常
if (await PermissionChecker.IsGrantedAsync(AbpOssManagementPermissions.OssObject.Default)) if (await FeatureChecker.IsEnabledAsync(AbpOssManagementFeatureNames.OssObject.Enable) &&
await PermissionChecker.IsGrantedAsync(AbpOssManagementPermissions.OssObject.Default))
{ {
var ossSettingGroup = new SettingGroupDto(L["DisplayName:OssManagement"], L["Description:OssManagement"]); var ossSettingGroup = new SettingGroupDto(L["DisplayName:OssManagement"], L["Description:OssManagement"]);

1
aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/LINGYUN/Abp/PermissionManagement/OrganizationUnits/OrganizationUnitDeletedEventHandler.cs

@ -21,6 +21,7 @@ public class OrganizationUnitDeletedEventHandler :
public async Task HandleEventAsync(EntityDeletedEto<OrganizationUnitEto> eventData) public async Task HandleEventAsync(EntityDeletedEto<OrganizationUnitEto> eventData)
{ {
await PermissionManager.DeleteAsync(OrganizationUnitPermissionValueProvider.ProviderName, eventData.Entity.Code);
await PermissionManager.DeleteAsync(OrganizationUnitPermissionValueProvider.ProviderName, eventData.Entity.Id.ToString()); await PermissionManager.DeleteAsync(OrganizationUnitPermissionValueProvider.ProviderName, eventData.Entity.Id.ToString());
} }
} }

4
aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/LINGYUN/Abp/PermissionManagement/OrganizationUnits/OrganizationUnitPermissionManagementProvider.cs

@ -65,7 +65,7 @@ public class OrganizationUnitPermissionManagementProvider : PermissionManagement
{ {
var role = await IdentityRoleRepository.FindByNormalizedNameAsync(UserManager.NormalizeName(providerKey)); var role = await IdentityRoleRepository.FindByNormalizedNameAsync(UserManager.NormalizeName(providerKey));
var organizationUnits = await IdentityRoleRepository.GetOrganizationUnitsAsync(role.Id); var organizationUnits = await IdentityRoleRepository.GetOrganizationUnitsAsync(role.Id);
var roleOrganizationUnits = organizationUnits.Select(x => x.Id.ToString()); var roleOrganizationUnits = organizationUnits.Select(x => x.Code.ToString());
var quaryble = await PermissionGrantBasicRepository.GetQueryableAsync(); var quaryble = await PermissionGrantBasicRepository.GetQueryableAsync();
quaryble = quaryble.Where(x => x.ProviderName == Name && roleOrganizationUnits.Contains(x.ProviderKey) && names.Contains(x.Name)); quaryble = quaryble.Where(x => x.ProviderName == Name && roleOrganizationUnits.Contains(x.ProviderKey) && names.Contains(x.Name));
@ -78,7 +78,7 @@ public class OrganizationUnitPermissionManagementProvider : PermissionManagement
{ {
var userId = Guid.Parse(providerKey); var userId = Guid.Parse(providerKey);
var organizationUnits = await IdentityUserRepository.GetOrganizationUnitsAsync(id: userId); var organizationUnits = await IdentityUserRepository.GetOrganizationUnitsAsync(id: userId);
var userOrganizationUnits = organizationUnits.Select(x => x.Id.ToString()); var userOrganizationUnits = organizationUnits.Select(x => x.Code.ToString());
var quaryble = await PermissionGrantBasicRepository.GetQueryableAsync(); var quaryble = await PermissionGrantBasicRepository.GetQueryableAsync();
quaryble = quaryble.Where(x => x.ProviderName == Name && userOrganizationUnits.Contains(x.ProviderKey) && names.Contains(x.Name)); quaryble = quaryble.Where(x => x.ProviderName == Name && userOrganizationUnits.Contains(x.ProviderKey) && names.Contains(x.Name));

12
aspnet-core/modules/permissions-management/LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits/Volo/Abp/PermissionManagement/OrganizationUnitPermissionManagerExtensions.cs

@ -10,31 +10,31 @@ public static class OrganizationUnitPermissionManagerExtensions
{ {
public static Task<PermissionWithGrantedProviders> GetForOrganizationUnitAsync( public static Task<PermissionWithGrantedProviders> GetForOrganizationUnitAsync(
[NotNull] this IPermissionManager permissionManager, [NotNull] this IPermissionManager permissionManager,
Guid organizationUnitId, string organizationUnitCode,
string permissionName) string permissionName)
{ {
Check.NotNull(permissionManager, nameof(permissionManager)); Check.NotNull(permissionManager, nameof(permissionManager));
return permissionManager.GetAsync(permissionName, OrganizationUnitPermissionValueProvider.ProviderName, organizationUnitId.ToString()); return permissionManager.GetAsync(permissionName, OrganizationUnitPermissionValueProvider.ProviderName, organizationUnitCode);
} }
public static Task<List<PermissionWithGrantedProviders>> GetAllForOrganizationUnitAsync( public static Task<List<PermissionWithGrantedProviders>> GetAllForOrganizationUnitAsync(
[NotNull] this IPermissionManager permissionManager, [NotNull] this IPermissionManager permissionManager,
Guid organizationUnitId) string organizationUnitCode)
{ {
Check.NotNull(permissionManager, nameof(permissionManager)); Check.NotNull(permissionManager, nameof(permissionManager));
return permissionManager.GetAllAsync(OrganizationUnitPermissionValueProvider.ProviderName, organizationUnitId.ToString()); return permissionManager.GetAllAsync(OrganizationUnitPermissionValueProvider.ProviderName, organizationUnitCode);
} }
public static Task SetForOrganizationUnitAsync( public static Task SetForOrganizationUnitAsync(
[NotNull] this IPermissionManager permissionManager, [NotNull] this IPermissionManager permissionManager,
Guid organizationUnitId, string organizationUnitCode,
[NotNull] string permissionName, [NotNull] string permissionName,
bool isGranted) bool isGranted)
{ {
Check.NotNull(permissionManager, nameof(permissionManager)); Check.NotNull(permissionManager, nameof(permissionManager));
return permissionManager.SetAsync(permissionName, OrganizationUnitPermissionValueProvider.ProviderName, organizationUnitId.ToString(), isGranted); return permissionManager.SetAsync(permissionName, OrganizationUnitPermissionValueProvider.ProviderName, organizationUnitCode, isGranted);
} }
} }

2
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/NotificationDefinitionInitializer.cs

@ -52,7 +52,7 @@ public class NotificationDefinitionInitializer : ITransientDependency
return; return;
} }
await PreCacheDynamicNotificationsAsync(scope); // await PreCacheDynamicNotificationsAsync(scope);
} }
} }
catch (OperationCanceledException) catch (OperationCanceledException)

154
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs

@ -373,91 +373,95 @@ public class SettingAppService : ApplicationService, ISettingAppService, ISettin
#region 邮件设置 #region 邮件设置
var emailSettingGroup = new SettingGroupDto(L["DisplayName:Emailing"], L["Description:Emailing"]); if (await FeatureChecker.IsEnabledAsync(true, [SettingManagementFeatures.Enable, SettingManagementFeatures.AllowChangingEmailSettings]))
var defaultMailSetting = emailSettingGroup.AddSetting(L["DisplayName:Emailing.Default"], L["Description:Emailing.Default"]);
defaultMailSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.DefaultFromAddress),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.DefaultFromAddress, providerName, providerKey),
ValueType.String,
providerName)
.RequiredPermission("SettingManagement.Emailing");
defaultMailSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.DefaultFromDisplayName),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.DefaultFromDisplayName, providerName, providerKey),
ValueType.String,
providerName)
.RequiredPermission("SettingManagement.Emailing");
// 防止邮件设置泄露
if (await AuthorizationService.IsGrantedAsync(AbpSettingManagementPermissions.Settings.Manager))
{ {
var smtpSetting = emailSettingGroup.AddSetting(L["DisplayName:Emailing.Smtp"], L["Description:Emailing.Smtp"]); var emailSettingGroup = new SettingGroupDto(L["DisplayName:Emailing"], L["Description:Emailing"]);
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.EnableSsl), var defaultMailSetting = emailSettingGroup.AddSetting(L["DisplayName:Emailing.Default"], L["Description:Emailing.Default"]);
StringLocalizerFactory, defaultMailSetting.AddDetail(
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.EnableSsl, providerName, providerKey), await SettingDefinitionManager.GetAsync(EmailSettingNames.DefaultFromAddress),
ValueType.Boolean,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.UseDefaultCredentials),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.UseDefaultCredentials, providerName, providerKey),
ValueType.Boolean,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Domain),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Domain, providerName, providerKey),
ValueType.String,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Host),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Host, providerName, providerKey),
ValueType.String,
providerName);
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Port),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Port, providerName, providerKey),
ValueType.Number,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.UserName),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.UserName, providerName, providerKey),
ValueType.String,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Password),
StringLocalizerFactory, StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Password, providerName, providerKey), await SettingManager.GetOrNullAsync(EmailSettingNames.DefaultFromAddress, providerName, providerKey),
ValueType.String, ValueType.String,
providerName) providerName)
.RequiredPermission("SettingManagement.Emailing"); .RequiredPermission("SettingManagement.Emailing");
// 一个占位符,用于展现发送测试邮件 defaultMailSetting.AddDetail(
smtpSetting.AddDetail( await SettingDefinitionManager.GetAsync(EmailSettingNames.DefaultFromDisplayName),
new SettingDefinition(
name: "SendTestEmail",
displayName: LocalizableString.Create<AbpSettingManagementResource>("DisplayName:Emailing.SendTestEmail"),
description: LocalizableString.Create<AbpSettingManagementResource>("Description:Emailing.SendTestEmail")),
StringLocalizerFactory, StringLocalizerFactory,
"", await SettingManager.GetOrNullAsync(EmailSettingNames.DefaultFromDisplayName, providerName, providerKey),
ValueType.String, ValueType.String,
providerName) providerName)
.WithSlot("send-test-email")
.RequiredPermission("SettingManagement.Emailing"); .RequiredPermission("SettingManagement.Emailing");
}
settingGroups.AddGroup(emailSettingGroup); // 防止邮件设置泄露
if (await AuthorizationService.IsGrantedAsync(AbpSettingManagementPermissions.Settings.Manager))
{
var smtpSetting = emailSettingGroup.AddSetting(L["DisplayName:Emailing.Smtp"], L["Description:Emailing.Smtp"]);
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.EnableSsl),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.EnableSsl, providerName, providerKey),
ValueType.Boolean,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.UseDefaultCredentials),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.UseDefaultCredentials, providerName, providerKey),
ValueType.Boolean,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Domain),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Domain, providerName, providerKey),
ValueType.String,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Host),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Host, providerName, providerKey),
ValueType.String,
providerName);
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Port),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Port, providerName, providerKey),
ValueType.Number,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.UserName),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.UserName, providerName, providerKey),
ValueType.String,
providerName)
.RequiredPermission("SettingManagement.Emailing");
smtpSetting.AddDetail(
await SettingDefinitionManager.GetAsync(EmailSettingNames.Smtp.Password),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Password, providerName, providerKey),
ValueType.String,
providerName)
.RequiredPermission("SettingManagement.Emailing");
// 一个占位符,用于展现发送测试邮件
smtpSetting.AddDetail(
new SettingDefinition(
name: "SendTestEmail",
displayName: LocalizableString.Create<AbpSettingManagementResource>("DisplayName:Emailing.SendTestEmail"),
description: LocalizableString.Create<AbpSettingManagementResource>("Description:Emailing.SendTestEmail")),
StringLocalizerFactory,
"",
ValueType.String,
providerName)
.WithSlot("send-test-email")
.RequiredPermission("SettingManagement.Emailing");
}
settingGroups.AddGroup(emailSettingGroup);
}
#endregion #endregion

16
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobListener.cs

@ -128,11 +128,17 @@ public class QuartzJobListener : JobListenerSupport, ISingletonDependency
jobEventData.RepeatCount = simpleTrigger.RepeatCount; jobEventData.RepeatCount = simpleTrigger.RepeatCount;
} }
jobEventData.Description = context.JobDetail.Description; jobEventData.Description = context.JobDetail.Description;
jobEventData.RunTime = Clock.Now; jobEventData.RunTime = Clock.Normalize(context.FireTimeUtc.DateTime);
jobEventData.LastRunTime = context.PreviousFireTimeUtc?.LocalDateTime var lastRunTime = context.PreviousFireTimeUtc?.DateTime ?? context.Trigger.GetPreviousFireTimeUtc()?.DateTime;
?? context.Trigger.GetPreviousFireTimeUtc()?.LocalDateTime; if (lastRunTime.HasValue)
jobEventData.NextRunTime = context.NextFireTimeUtc?.LocalDateTime {
?? context.Trigger.GetNextFireTimeUtc()?.LocalDateTime; jobEventData.RunTime = Clock.Normalize(lastRunTime.Value);
}
var nextRunTime = context.NextFireTimeUtc?.DateTime ?? context.Trigger.GetNextFireTimeUtc()?.DateTime;
if (nextRunTime.HasValue)
{
jobEventData.NextRunTime = Clock.Normalize(nextRunTime.Value);
}
if (context.Result != null) if (context.Result != null)
{ {
jobEventData.Result = context.Result?.ToString(); jobEventData.Result = context.Result?.ToString();

8
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain.Shared/LINGYUN/Abp/TextTemplating/TextTemplateEto.cs

@ -1,11 +1,7 @@
using System; namespace LINGYUN.Abp.TextTemplating;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TextTemplating; public class TextTemplateEto
public class TextTemplateEto : IMultiTenant
{ {
public Guid? TenantId { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string DisplayName { get; set; } public string DisplayName { get; set; }
public string Content { get; set; } public string Content { get; set; }

7
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/IStaticTemplateDefinitionSaver.cs

@ -1,7 +0,0 @@
using System.Threading.Tasks;
namespace LINGYUN.Abp.TextTemplating;
public interface IStaticTemplateDefinitionSaver
{
Task SaveAsync();
}

9
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/IStaticTemplateSaver.cs

@ -0,0 +1,9 @@
using System.Threading.Tasks;
namespace LINGYUN.Abp.TextTemplating;
public interface IStaticTemplateSaver
{
Task SaveDefinitionTemplateAsync();
Task SaveTemplateContentAsync();
}

2
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/InMemoryTemplateDefinitionStoreCache.cs

@ -37,7 +37,7 @@ public class InMemoryTemplateDefinitionStoreCache : ITemplateDefinitionStoreCach
{ {
var templateDefinition = new TemplateDefinition( var templateDefinition = new TemplateDefinition(
templateDefinitionRecord.Name, templateDefinitionRecord.Name,
typeof(NonTypedLocalizationResource), templateDefinitionRecord.LocalizationResourceName,
LocalizableStringSerializer.Deserialize(templateDefinitionRecord.DisplayName), LocalizableStringSerializer.Deserialize(templateDefinitionRecord.DisplayName),
templateDefinitionRecord.IsLayout, templateDefinitionRecord.IsLayout,
templateDefinitionRecord.Layout, templateDefinitionRecord.Layout,

225
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/StaticTemplateDefinitionSaver.cs → aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/StaticTemplateSaver.cs

@ -1,96 +1,129 @@
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.DistributedLocking; using Volo.Abp.DistributedLocking;
using Volo.Abp.Guids; using Volo.Abp.Guids;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.TextTemplating; using Volo.Abp.TextTemplating;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace LINGYUN.Abp.TextTemplating; namespace LINGYUN.Abp.TextTemplating;
public class StaticTemplateDefinitionSaver : IStaticTemplateDefinitionSaver, ITransientDependency public class StaticTemplateSaver : IStaticTemplateSaver, ITransientDependency
{ {
protected AbpDistributedCacheOptions CacheOptions { get; } protected AbpDistributedCacheOptions CacheOptions { get; }
protected IGuidGenerator GuidGenerator { get; } protected IGuidGenerator GuidGenerator { get; }
protected IAbpDistributedLock DistributedLock { get; } protected IAbpDistributedLock DistributedLock { get; }
protected ITextTemplateDefinitionRepository TemplateDefinitionRepository { get; } protected ITextTemplateRepository TextTemplateRepository { get; }
protected AbpTextTemplatingCachingOptions TemplatingCachingOptions { get; } protected ITextTemplateDefinitionRepository TemplateDefinitionRepository { get; }
protected IStaticTemplateDefinitionStore StaticTemplateDefinitionStore { get; } protected AbpTextTemplatingCachingOptions TemplatingCachingOptions { get; }
protected ILocalizableStringSerializer LocalizableStringSerializer { get; } protected IStaticTemplateDefinitionStore StaticTemplateDefinitionStore { get; }
protected ILocalizableStringSerializer LocalizableStringSerializer { get; }
public StaticTemplateDefinitionSaver( protected ITemplateContentProvider TemplateContentProvider { get; }
IOptions<AbpDistributedCacheOptions> cacheOptions,
IOptions<AbpTextTemplatingCachingOptions> templatingCachingOptions, public StaticTemplateSaver(
IGuidGenerator guidGenerator, IOptions<AbpDistributedCacheOptions> cacheOptions,
IAbpDistributedLock distributedLock, IOptions<AbpTextTemplatingCachingOptions> templatingCachingOptions,
ITextTemplateDefinitionRepository templateDefinitionRepository, IGuidGenerator guidGenerator,
IStaticTemplateDefinitionStore staticTemplateDefinitionStore, IAbpDistributedLock distributedLock,
ILocalizableStringSerializer localizableStringSerializer) ITextTemplateRepository textTemplateRepository,
{ ITextTemplateDefinitionRepository templateDefinitionRepository,
CacheOptions = cacheOptions.Value; IStaticTemplateDefinitionStore staticTemplateDefinitionStore,
GuidGenerator = guidGenerator; ILocalizableStringSerializer localizableStringSerializer,
DistributedLock = distributedLock; ITemplateContentProvider templateContentProvider)
TemplateDefinitionRepository = templateDefinitionRepository; {
TemplatingCachingOptions = templatingCachingOptions.Value; CacheOptions = cacheOptions.Value;
StaticTemplateDefinitionStore = staticTemplateDefinitionStore; GuidGenerator = guidGenerator;
LocalizableStringSerializer = localizableStringSerializer; DistributedLock = distributedLock;
} TextTemplateRepository = textTemplateRepository;
TemplateDefinitionRepository = templateDefinitionRepository;
[UnitOfWork] TemplatingCachingOptions = templatingCachingOptions.Value;
public async virtual Task SaveAsync() StaticTemplateDefinitionStore = staticTemplateDefinitionStore;
{ LocalizableStringSerializer = localizableStringSerializer;
if (TemplatingCachingOptions.SaveStaticTemplateDefinitionToDatabase) TemplateContentProvider = templateContentProvider;
{ }
await using var commonLockHandle = await DistributedLock
.TryAcquireAsync(GetCommonDistributedLockKey(), TemplatingCachingOptions.TemplateDefinitionsCacheStampTimeOut); [UnitOfWork]
public async virtual Task SaveDefinitionTemplateAsync()
if (commonLockHandle == null) {
{ if (TemplatingCachingOptions.SaveStaticTemplateDefinitionToDatabase)
return; {
} await using var commonLockHandle = await DistributedLock
.TryAcquireAsync(GetCommonDistributedLockKey(), TemplatingCachingOptions.TemplateDefinitionsCacheStampTimeOut);
var templateDefinitions = await StaticTemplateDefinitionStore.GetAllAsync();
if (commonLockHandle == null)
var saveNewTemplateDefinitionRecords = new List<TextTemplateDefinition>(); {
return;
foreach (var templateDefinition in templateDefinitions) }
{
if (await TemplateDefinitionRepository.FindByNameAsync(templateDefinition.Name) != null) var templateDefinitions = await StaticTemplateDefinitionStore.GetAllAsync();
{
continue; var saveNewTemplateDefinitionRecords = new List<TextTemplateDefinition>();
}
foreach (var templateDefinition in templateDefinitions)
var templateDefinitionRecord = new TextTemplateDefinition( {
GuidGenerator.Create(), if (await TemplateDefinitionRepository.FindByNameAsync(templateDefinition.Name) != null)
templateDefinition.Name, {
LocalizableStringSerializer.Serialize(templateDefinition.DisplayName), continue;
templateDefinition.IsLayout, }
templateDefinition.Layout,
templateDefinition.IsInlineLocalized, var templateDefinitionRecord = new TextTemplateDefinition(
templateDefinition.DefaultCultureName, GuidGenerator.Create(),
templateDefinition.RenderEngine) templateDefinition.Name,
{ LocalizableStringSerializer.Serialize(templateDefinition.DisplayName),
IsStatic = true templateDefinition.IsLayout,
}; templateDefinition.Layout,
templateDefinition.IsInlineLocalized,
foreach (var property in templateDefinition.Properties) templateDefinition.DefaultCultureName,
{ templateDefinition.LocalizationResourceName,
templateDefinitionRecord.SetProperty(property.Key, property.Value); templateDefinition.RenderEngine)
} {
IsStatic = true
saveNewTemplateDefinitionRecords.Add(templateDefinitionRecord); };
}
foreach (var property in templateDefinition.Properties)
await TemplateDefinitionRepository.InsertManyAsync(saveNewTemplateDefinitionRecords); {
} templateDefinitionRecord.SetProperty(property.Key, property.Value);
} }
protected virtual string GetCommonDistributedLockKey() saveNewTemplateDefinitionRecords.Add(templateDefinitionRecord);
{ }
return $"{CacheOptions.KeyPrefix}_Common_AbpTemplateDefinitionStaticSaverLock";
} await TemplateDefinitionRepository.InsertManyAsync(saveNewTemplateDefinitionRecords);
} }
}
[UnitOfWork]
public async virtual Task SaveTemplateContentAsync()
{
var saveNewTemplates = new List<TextTemplate>();
var templateDefinitions = await StaticTemplateDefinitionStore.GetAllAsync();
foreach (var templateDefinition in templateDefinitions)
{
var culture = templateDefinition.IsInlineLocalized ? null : templateDefinition.DefaultCultureName;
if (await TextTemplateRepository.FindByNameAsync(templateDefinition.Name, culture) != null)
{
continue;
}
var content = await TemplateContentProvider.GetContentOrNullAsync(templateDefinition, culture);
var textTemplate = new TextTemplate(
GuidGenerator.Create(),
templateDefinition.Name,
LocalizableStringSerializer.Serialize(templateDefinition.DisplayName),
content,
culture);
saveNewTemplates.Add(textTemplate);
}
await TextTemplateRepository.InsertManyAsync(saveNewTemplates);
}
protected virtual string GetCommonDistributedLockKey()
{
return $"{CacheOptions.KeyPrefix}_Common_AbpTemplateDefinitionStaticSaverLock";
}
}

4
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplate.cs

@ -1,13 +1,11 @@
using System; using System;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TextTemplating; namespace LINGYUN.Abp.TextTemplating;
public class TextTemplate : AuditedEntity<Guid>, IMultiTenant public class TextTemplate : AuditedEntity<Guid>
{ {
public virtual Guid? TenantId { get; protected set; }
public virtual string Name { get; private set; } public virtual string Name { get; private set; }
public virtual string DisplayName { get; private set; } public virtual string DisplayName { get; private set; }
public virtual string Content { get; private set; } public virtual string Content { get; private set; }

5
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateCacheItemInvalidator.cs

@ -39,10 +39,7 @@ public class TextTemplateCacheItemInvalidator :
template.Culture template.Culture
); );
using (CurrentTenant.Change(template.TenantId)) await Cache.RemoveAsync(cacheKey);
{
await Cache.RemoveAsync(cacheKey);
}
} }
protected virtual string CalculateCacheKey(string name, string culture = null) protected virtual string CalculateCacheKey(string name, string culture = null)

2
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentCacheItem.cs

@ -1,8 +1,10 @@
using System; using System;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Abp.TextTemplating; namespace LINGYUN.Abp.TextTemplating;
[Serializable] [Serializable]
[IgnoreMultiTenancy]
public class TextTemplateContentCacheItem public class TextTemplateContentCacheItem
{ {
private const string CacheKeyFormat = "pn:template-content,n:{0},c:{1}"; private const string CacheKeyFormat = "pn:template-content,n:{0},c:{1}";

9
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateContentContributor.cs

@ -23,7 +23,10 @@ public class TextTemplateContentContributor : ITemplateContentContributor, ITran
public async virtual Task<string> GetOrNullAsync(TemplateContentContributorContext context) public async virtual Task<string> GetOrNullAsync(TemplateContentContributorContext context)
{ {
var cacheKey = TextTemplateContentCacheItem.CalculateCacheKey(context.TemplateDefinition.Name, context.Culture); // 2024/05/27 fixed 内联本地化不需要多语言
var culture = context.TemplateDefinition.IsInlineLocalized ? null : context.Culture;
var cacheKey = TextTemplateContentCacheItem.CalculateCacheKey(context.TemplateDefinition.Name, culture);
var cacheItem = await TextTemplateContentCache.GetOrAddAsync(cacheKey, var cacheItem = await TextTemplateContentCache.GetOrAddAsync(cacheKey,
() => CreateTemplateContentCache(context), () => CreateTemplateContentCache(context),
@ -34,8 +37,10 @@ public class TextTemplateContentContributor : ITemplateContentContributor, ITran
protected async virtual Task<TextTemplateContentCacheItem> CreateTemplateContentCache(TemplateContentContributorContext context) protected async virtual Task<TextTemplateContentCacheItem> CreateTemplateContentCache(TemplateContentContributorContext context)
{ {
// 2024/05/27 fixed 内联本地化不需要多语言
var culture = context.TemplateDefinition.IsInlineLocalized ? null : context.Culture;
var repository = context.ServiceProvider.GetRequiredService<ITextTemplateRepository>(); var repository = context.ServiceProvider.GetRequiredService<ITextTemplateRepository>();
var template = await repository.FindByNameAsync(context.TemplateDefinition.Name, context.Culture); var template = await repository.FindByNameAsync(context.TemplateDefinition.Name, culture);
return new TextTemplateContentCacheItem( return new TextTemplateContentCacheItem(
template?.Name, template?.Name,

6
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateDefinitionInitializer.cs

@ -69,9 +69,11 @@ public class TextTemplateDefinitionInitializer : ITransientDependency
try try
{ {
// ReSharper disable once AccessToDisposedClosure // ReSharper disable once AccessToDisposedClosure
var saver = serviceScope.ServiceProvider.GetRequiredService<IStaticTemplateDefinitionSaver>(); var saver = serviceScope.ServiceProvider.GetRequiredService<IStaticTemplateSaver>();
await saver.SaveAsync(); await saver.SaveDefinitionTemplateAsync();
await saver.SaveTemplateContentAsync();
} }
catch (Exception ex) catch (Exception ex)
{ {

2
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDbContextModelCreatingExtensions.cs

@ -33,7 +33,7 @@ public static class AbpTextTemplatingDbContextModelCreatingExtensions
.HasColumnName(nameof(TextTemplate.Content)) .HasColumnName(nameof(TextTemplate.Content))
.HasMaxLength(TextTemplateConsts.MaxContentLength); .HasMaxLength(TextTemplateConsts.MaxContentLength);
b.HasIndex(p => new { p.TenantId, p.Name }) b.HasIndex(p => p.Name)
.HasDatabaseName("IX_Tenant_Text_Template_Name"); .HasDatabaseName("IX_Tenant_Text_Template_Name");
b.ApplyObjectExtensionMappings(); b.ApplyObjectExtensionMappings();

3
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

18
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN.Abp.TextTemplating.Scriban.csproj

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Scriban" />
<PackageReference Include="Volo.Abp.TextTemplating.Core" />
</ItemGroup>
</Project>

17
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/AbpTextTemplatingScribanModule.cs

@ -0,0 +1,17 @@
using Volo.Abp.Modularity;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.TextTemplating.Scriban;
[DependsOn(typeof(AbpTextTemplatingCoreModule))]
public class AbpTextTemplatingScribanModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpTextTemplatingOptions>(options =>
{
options.DefaultRenderingEngine = ScribanTemplateRenderingEngine.EngineName;
options.RenderingEngines[ScribanTemplateRenderingEngine.EngineName] = typeof(ScribanTemplateRenderingEngine);
});
}
}

12
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateDefinitionExtensions.cs

@ -0,0 +1,12 @@
using JetBrains.Annotations;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.TextTemplating.Scriban;
public static class ScribanTemplateDefinitionExtensions
{
public static TemplateDefinition WithScribanEngine([NotNull] this TemplateDefinition templateDefinition)
{
return templateDefinition.WithRenderEngine(ScribanTemplateRenderingEngine.EngineName);
}
}

64
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateLocalizer.cs

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using Scriban;
using Scriban.Runtime;
using Scriban.Syntax;
namespace LINGYUN.Abp.TextTemplating.Scriban;
public class ScribanTemplateLocalizer : IScriptCustomFunction
{
private readonly IStringLocalizer _localizer;
public ScribanTemplateLocalizer(IStringLocalizer localizer)
{
_localizer = localizer;
}
public object Invoke(TemplateContext context, ScriptNode callerContext, ScriptArray arguments,
ScriptBlockStatement blockStatement)
{
return GetString(arguments);
}
public ValueTask<object> InvokeAsync(TemplateContext context, ScriptNode callerContext, ScriptArray arguments,
ScriptBlockStatement blockStatement)
{
return new ValueTask<object>(GetString(arguments));
}
private string GetString(ScriptArray arguments)
{
if (arguments.IsNullOrEmpty())
{
return string.Empty;
}
var name = arguments[0];
if (name == null || name.ToString().IsNullOrWhiteSpace())
{
return string.Empty;
}
var args = arguments.Skip(1).Where(x => x != null && !x.ToString().IsNullOrWhiteSpace()).ToArray();
return args.Any() ? _localizer[name.ToString()!, args] : _localizer[name.ToString()!];
}
public int RequiredParameterCount => 1;
public int ParameterCount => ScriptFunctionCall.MaximumParameterCount - 1;
public ScriptVarParamKind VarParamKind => ScriptVarParamKind.Direct;
public Type ReturnType => typeof(object);
public ScriptParameterInfo GetParameterInfo(int index)
{
return index == 0
? new ScriptParameterInfo(typeof(string), "template_name")
: new ScriptParameterInfo(typeof(object), "value");
}
}

154
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Scriban/LINGYUN/Abp/TextTemplating/Scriban/ScribanTemplateRenderingEngine.cs

@ -0,0 +1,154 @@
using JetBrains.Annotations;
using Microsoft.Extensions.Localization;
using Scriban;
using Scriban.Runtime;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Localization;
using Volo.Abp.TextTemplating;
namespace LINGYUN.Abp.TextTemplating.Scriban;
public class ScribanTemplateRenderingEngine : TemplateRenderingEngineBase, ITransientDependency
{
public const string EngineName = "Scriban";
public override string Name => EngineName;
public ScribanTemplateRenderingEngine(
ITemplateDefinitionManager templateDefinitionManager,
ITemplateContentProvider templateContentProvider,
IStringLocalizerFactory stringLocalizerFactory)
: base(templateDefinitionManager, templateContentProvider, stringLocalizerFactory)
{
}
public override async Task<string> RenderAsync(
[NotNull] string templateName,
object? model = null,
string? cultureName = null,
Dictionary<string, object>? globalContext = null)
{
Check.NotNullOrWhiteSpace(templateName, nameof(templateName));
if (globalContext == null)
{
globalContext = new Dictionary<string, object>();
}
if (cultureName == null)
{
return await RenderInternalAsync(
templateName,
globalContext,
model
);
}
else
{
using (CultureHelper.Use(cultureName))
{
return await RenderInternalAsync(
templateName,
globalContext,
model
);
}
}
}
protected virtual async Task<string> RenderInternalAsync(
string templateName,
Dictionary<string, object> globalContext,
object? model = null)
{
var templateDefinition = await TemplateDefinitionManager.GetAsync(templateName);
var renderedContent = await RenderSingleTemplateAsync(
templateDefinition,
globalContext,
model
);
if (templateDefinition.Layout != null)
{
globalContext["content"] = renderedContent;
renderedContent = await RenderInternalAsync(
templateDefinition.Layout,
globalContext
);
}
return renderedContent;
}
protected virtual async Task<string> RenderSingleTemplateAsync(
TemplateDefinition templateDefinition,
Dictionary<string, object> globalContext,
object? model = null)
{
var rawTemplateContent = await GetContentOrNullAsync(templateDefinition);
return await RenderTemplateContentWithScribanAsync(
templateDefinition,
rawTemplateContent!,
globalContext,
model
);
}
protected virtual async Task<string> RenderTemplateContentWithScribanAsync(
TemplateDefinition templateDefinition,
string templateContent,
Dictionary<string, object> globalContext,
object? model = null)
{
var context = await CreateScribanTemplateContextAsync(
templateDefinition,
globalContext,
model
);
return await Template
.Parse(templateContent)
.RenderAsync(context);
}
protected async virtual Task<TemplateContext> CreateScribanTemplateContextAsync(
TemplateDefinition templateDefinition,
Dictionary<string, object> globalContext,
object? model = null)
{
var context = new TemplateContext();
var scriptObject = new ScriptObject();
scriptObject.Import(globalContext);
if (model != null)
{
scriptObject["model"] = model;
}
var localizer = await GetLocalizerOrNullAsync(templateDefinition);
if (localizer != null)
{
scriptObject.SetValue("L", new ScribanTemplateLocalizer(localizer), true);
}
context.PushGlobal(scriptObject);
context.PushCulture(System.Globalization.CultureInfo.CurrentCulture);
return context;
}
protected async virtual Task<IStringLocalizer?> GetLocalizerOrNullAsync(TemplateDefinition templateDefinition)
{
if (templateDefinition.LocalizationResourceName != null)
{
return await StringLocalizerFactory.CreateByResourceNameOrNullAsync(templateDefinition.LocalizationResourceName);
}
return StringLocalizerFactory.CreateDefaultOrNull();
}
}

11
aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/AuthServerHttpApiHostModule.Configure.cs

@ -24,6 +24,7 @@ using System.Linq;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Caching; using Volo.Abp.Caching;
@ -158,7 +159,7 @@ public partial class AuthServerHttpApiHostModule
}); });
} }
private void ConfigreExceptionHandling() private void ConfigureExceptionHandling()
{ {
// 自定义需要处理的异常 // 自定义需要处理的异常
Configure<AbpExceptionHandlingOptions>(options => Configure<AbpExceptionHandlingOptions>(options =>
@ -243,6 +244,14 @@ public partial class AuthServerHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

3
aspnet-core/services/LY.MicroService.AuthServer.HttpApi.Host/AuthServerHttpApiHostModule.cs

@ -80,10 +80,11 @@ public partial class AuthServerHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureIdentity(); ConfigureIdentity();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();
ConfigreExceptionHandling(); ConfigureExceptionHandling();
ConfigureVirtualFileSystem(); ConfigureVirtualFileSystem();
ConfigureFeatureManagement(); ConfigureFeatureManagement();
ConfigurePermissionManagement(); ConfigurePermissionManagement();

9
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs

@ -24,6 +24,7 @@ using System.Linq;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Authorization.Permissions; using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Caching; using Volo.Abp.Caching;
@ -237,6 +238,14 @@ public partial class BackendAdminHttpApiHostModule
} }
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

21
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs

@ -1,4 +1,5 @@
using LINGYUN.Abp.AspNetCore.HttpOverrides; using LINGYUN.Abp.Aliyun.SettingManagement;
using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AspNetCore.Mvc.Localization; using LINGYUN.Abp.AspNetCore.Mvc.Localization;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper; using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using LINGYUN.Abp.Auditing; using LINGYUN.Abp.Auditing;
@ -16,6 +17,7 @@ using LINGYUN.Abp.Identity.EntityFrameworkCore;
using LINGYUN.Abp.Localization.CultureMap; using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
using LINGYUN.Abp.Logging.Serilog.Elasticsearch; using LINGYUN.Abp.Logging.Serilog.Elasticsearch;
using LINGYUN.Abp.OssManagement.SettingManagement;
using LINGYUN.Abp.PermissionManagement; using LINGYUN.Abp.PermissionManagement;
using LINGYUN.Abp.PermissionManagement.HttpApi; using LINGYUN.Abp.PermissionManagement.HttpApi;
using LINGYUN.Abp.PermissionManagement.OrganizationUnits; using LINGYUN.Abp.PermissionManagement.OrganizationUnits;
@ -25,8 +27,12 @@ using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.Sms.Aliyun; using LINGYUN.Abp.Sms.Aliyun;
using LINGYUN.Abp.Tencent.SettingManagement;
using LINGYUN.Abp.TextTemplating; using LINGYUN.Abp.TextTemplating;
using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; using LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
using LINGYUN.Abp.TextTemplating.Scriban;
using LINGYUN.Abp.WeChat.SettingManagement;
using LINGYUN.Abp.WxPusher.SettingManagement;
using LY.MicroService.BackendAdmin.EntityFrameworkCore; using LY.MicroService.BackendAdmin.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -58,6 +64,14 @@ namespace LY.MicroService.BackendAdmin;
typeof(AbpAuditLoggingElasticsearchModule), typeof(AbpAuditLoggingElasticsearchModule),
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpAspNetCoreMvcLocalizationModule), typeof(AbpAspNetCoreMvcLocalizationModule),
// 设置管理
typeof(AbpAliyunSettingManagementModule),
typeof(AbpTencentCloudSettingManagementModule),
typeof(AbpWeChatSettingManagementModule),
typeof(AbpWxPusherSettingManagementModule),
typeof(AbpOssManagementSettingManagementModule),
typeof(AbpSettingManagementApplicationModule), typeof(AbpSettingManagementApplicationModule),
typeof(AbpSettingManagementHttpApiModule), typeof(AbpSettingManagementHttpApiModule),
typeof(AbpPermissionManagementApplicationModule), typeof(AbpPermissionManagementApplicationModule),
@ -88,6 +102,10 @@ namespace LY.MicroService.BackendAdmin;
typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule),
typeof(AbpLocalizationManagementEntityFrameworkCoreModule), typeof(AbpLocalizationManagementEntityFrameworkCoreModule),
typeof(AbpTextTemplatingEntityFrameworkCoreModule), typeof(AbpTextTemplatingEntityFrameworkCoreModule),
// 重写模板引擎支持外部本地化
typeof(AbpTextTemplatingScribanModule),
typeof(BackendAdminMigrationsEntityFrameworkCoreModule), typeof(BackendAdminMigrationsEntityFrameworkCoreModule),
typeof(AbpDataDbMigratorModule), typeof(AbpDataDbMigratorModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
@ -116,6 +134,7 @@ public partial class BackendAdminHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();
ConfigureExceptionHandling(); ConfigureExceptionHandling();

6
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj

@ -51,6 +51,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" /> <ProjectReference Include="..\..\framework\auditing\LINGYUN.Abp.AuditLogging.Elasticsearch\LINGYUN.Abp.AuditLogging.Elasticsearch.csproj" />
<ProjectReference Include="..\..\framework\cloud-aliyun\LINGYUN.Abp.Aliyun.SettingManagement\LINGYUN.Abp.Aliyun.SettingManagement.csproj" />
<ProjectReference Include="..\..\framework\cloud-tencent\LINGYUN.Abp.Tencent.SettingManagement\LINGYUN.Abp.Tencent.SettingManagement.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" /> <ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Data.DbMigrator\LINGYUN.Abp.Data.DbMigrator.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" /> <ProjectReference Include="..\..\framework\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" /> <ProjectReference Include="..\..\framework\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
@ -65,6 +67,8 @@
<ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" /> <ProjectReference Include="..\..\framework\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" />
<ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" /> <ProjectReference Include="..\..\framework\mvc\LINGYUN.Abp.AspNetCore.Mvc.Wrapper\LINGYUN.Abp.AspNetCore.Mvc.Wrapper.csproj" />
<ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj" /> <ProjectReference Include="..\..\framework\security\LINGYUN.Abp.Security\LINGYUN.Abp.Security.csproj" />
<ProjectReference Include="..\..\framework\wechat\LINGYUN.Abp.WeChat.SettingManagement\LINGYUN.Abp.WeChat.SettingManagement.csproj" />
<ProjectReference Include="..\..\framework\wx-pusher\LINGYUN.Abp.WxPusher.SettingManagement\LINGYUN.Abp.WxPusher.SettingManagement.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -80,6 +84,7 @@
<ProjectReference Include="..\..\modules\feature-management\LINGYUN.Abp.FeatureManagement.HttpApi\LINGYUN.Abp.FeatureManagement.HttpApi.csproj" /> <ProjectReference Include="..\..\modules\feature-management\LINGYUN.Abp.FeatureManagement.HttpApi\LINGYUN.Abp.FeatureManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.EntityFrameworkCore\LINGYUN.Abp.Identity.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.Identity.EntityFrameworkCore\LINGYUN.Abp.Identity.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\modules\localization-management\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore\LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\oss-management\LINGYUN.Abp.OssManagement.SettingManagement\LINGYUN.Abp.OssManagement.SettingManagement.csproj" />
<!--<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.PermissionManagement.Domain.Identity\LINGYUN.Abp.PermissionManagement.Domain.Identity.csproj" />--> <!--<ProjectReference Include="..\..\modules\identity\LINGYUN.Abp.PermissionManagement.Domain.Identity\LINGYUN.Abp.PermissionManagement.Domain.Identity.csproj" />-->
<ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.Application\LINGYUN.Abp.PermissionManagement.Application.csproj" /> <ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.Application\LINGYUN.Abp.PermissionManagement.Application.csproj" />
<ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits.csproj" /> <ProjectReference Include="..\..\modules\permissions-management\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits\LINGYUN.Abp.PermissionManagement.Domain.OrganizationUnits.csproj" />
@ -92,5 +97,6 @@
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Application\LINGYUN.Abp.TextTemplating.Application.csproj" /> <ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Application\LINGYUN.Abp.TextTemplating.Application.csproj" />
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.HttpApi\LINGYUN.Abp.TextTemplating.HttpApi.csproj" /> <ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.HttpApi\LINGYUN.Abp.TextTemplating.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Scriban\LINGYUN.Abp.TextTemplating.Scriban.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

11
aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/IdentityServerHttpApiHostModule.Configure.cs

@ -44,6 +44,7 @@ using Volo.Abp.Security.Claims;
using System.Collections.Generic; using System.Collections.Generic;
using IdentityModel; using IdentityModel;
using System.Security.Claims; using System.Security.Claims;
using Volo.Abp.AspNetCore.Mvc;
namespace LY.MicroService.IdentityServer; namespace LY.MicroService.IdentityServer;
@ -160,7 +161,7 @@ public partial class IdentityServerHttpApiHostModule
}); });
} }
private void ConfigreExceptionHandling() private void ConfigureExceptionHandling()
{ {
// 自定义需要处理的异常 // 自定义需要处理的异常
Configure<AbpExceptionHandlingOptions>(options => Configure<AbpExceptionHandlingOptions>(options =>
@ -244,6 +245,14 @@ public partial class IdentityServerHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

3
aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs

@ -86,10 +86,11 @@ public partial class IdentityServerHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureIdentity(); ConfigureIdentity();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();
ConfigreExceptionHandling(); ConfigureExceptionHandling();
ConfigureVirtualFileSystem(); ConfigureVirtualFileSystem();
ConfigureFeatureManagement(); ConfigureFeatureManagement();
ConfigurePermissionManagement(); ConfigurePermissionManagement();

9
aspnet-core/services/LY.MicroService.IdentityServer/IdentityServerModule.Configure.cs

@ -2,6 +2,7 @@
using IdentityModel; using IdentityModel;
using LINGYUN.Abp.Account; using LINGYUN.Abp.Account;
using LINGYUN.Abp.AspNetCore.HttpOverrides.Forwarded; using LINGYUN.Abp.AspNetCore.HttpOverrides.Forwarded;
using LINGYUN.Abp.Authorization.OrganizationUnits;
using LINGYUN.Abp.IdentityServer.IdentityResources; using LINGYUN.Abp.IdentityServer.IdentityResources;
using LINGYUN.Abp.Localization.CultureMap; using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.Application;
@ -209,6 +210,14 @@ public partial class IdentityServerModule
} }
}); });
Configure<AbpClaimsServiceOptions>(options =>
{
options.RequestedClaims.AddRange(new[]
{
AbpOrganizationUnitClaimTypes.OrganizationUnit
});
});
Configure<AbpClaimsPrincipalFactoryOptions>(options => Configure<AbpClaimsPrincipalFactoryOptions>(options =>
{ {
options.IsDynamicClaimsEnabled = true; options.IsDynamicClaimsEnabled = true;

11
aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.Configure.cs

@ -23,6 +23,7 @@ using System.Linq;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -133,7 +134,7 @@ public partial class LocalizationManagementHttpApiHostModule
}); });
} }
private void ConfigreExceptionHandling() private void ConfigureExceptionHandling()
{ {
// 自定义需要处理的异常 // 自定义需要处理的异常
Configure<AbpExceptionHandlingOptions>(options => Configure<AbpExceptionHandlingOptions>(options =>
@ -195,6 +196,14 @@ public partial class LocalizationManagementHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

3
aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.cs

@ -74,9 +74,10 @@ namespace LY.MicroService.LocalizationManagement
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();
ConfigreExceptionHandling(); ConfigureExceptionHandling();
ConfigureVirtualFileSystem(); ConfigureVirtualFileSystem();
ConfigureFeatureManagement(); ConfigureFeatureManagement();
ConfigureCaching(configuration); ConfigureCaching(configuration);

11
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs

@ -27,6 +27,7 @@ using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem; using Volo.Abp.BlobStoring.FileSystem;
@ -162,7 +163,7 @@ public partial class PlatformManagementHttpApiHostModule
}); });
} }
private void ConfigreExceptionHandling() private void ConfigureExceptionHandling()
{ {
// 自定义需要处理的异常 // 自定义需要处理的异常
Configure<AbpExceptionHandlingOptions>(options => Configure<AbpExceptionHandlingOptions>(options =>
@ -232,6 +233,14 @@ public partial class PlatformManagementHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

4
aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs

@ -19,7 +19,6 @@ using LINGYUN.Abp.Saas.EntityFrameworkCore;
using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using LINGYUN.Abp.UI.Navigation.VueVbenAdmin; using LINGYUN.Abp.UI.Navigation.VueVbenAdmin;
using LINGYUN.Abp.WeChat.Work;
using LINGYUN.Platform; using LINGYUN.Platform;
using LINGYUN.Platform.EntityFrameworkCore; using LINGYUN.Platform.EntityFrameworkCore;
using LINGYUN.Platform.HttpApi; using LINGYUN.Platform.HttpApi;
@ -109,11 +108,12 @@ public partial class PlatformManagementHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureDbContext(); ConfigureDbContext();
ConfigureBlobStoring(); ConfigureBlobStoring();
ConfigureLocalization(); ConfigureLocalization();
ConfigureKestrelServer(); ConfigureKestrelServer();
ConfigreExceptionHandling(); ConfigureExceptionHandling();
ConfigureVirtualFileSystem(); ConfigureVirtualFileSystem();
ConfigureFeatureManagement(); ConfigureFeatureManagement();
ConfigureCaching(configuration); ConfigureCaching(configuration);

1
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj

@ -88,6 +88,7 @@
<ProjectReference Include="..\..\modules\realtime-message\LINGYUN.Abp.MessageService.HttpApi\LINGYUN.Abp.MessageService.HttpApi.csproj" /> <ProjectReference Include="..\..\modules\realtime-message\LINGYUN.Abp.MessageService.HttpApi\LINGYUN.Abp.MessageService.HttpApi.csproj" />
<ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\modules\saas\LINGYUN.Abp.Saas.EntityFrameworkCore\LINGYUN.Abp.Saas.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.EntityFrameworkCore\LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\modules\text-templating\LINGYUN.Abp.TextTemplating.Scriban\LINGYUN.Abp.TextTemplating.Scriban.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

21
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.Configure.cs

@ -43,6 +43,8 @@ using Microsoft.IdentityModel.Logging;
using LINGYUN.Abp.AspNetCore.HttpOverrides.Forwarded; using LINGYUN.Abp.AspNetCore.HttpOverrides.Forwarded;
using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.HttpOverrides;
using Volo.Abp.Security.Claims; using Volo.Abp.Security.Claims;
using Volo.Abp.AspNetCore.Mvc;
using LINGYUN.Abp.TextTemplating;
namespace LY.MicroService.RealtimeMessage; namespace LY.MicroService.RealtimeMessage;
@ -159,6 +161,14 @@ public partial class RealtimeMessageHttpApiHostModule
}); });
} }
private void ConfigureTextTemplating()
{
Configure<AbpTextTemplatingCachingOptions>(options =>
{
options.IsDynamicTemplateDefinitionStoreEnabled = true;
});
}
private void ConfigureFeatureManagement() private void ConfigureFeatureManagement()
{ {
Configure<FeatureManagementOptions>(options => Configure<FeatureManagementOptions>(options =>
@ -185,7 +195,7 @@ public partial class RealtimeMessageHttpApiHostModule
}); });
} }
private void ConfigreExceptionHandling() private void ConfigureExceptionHandling()
{ {
// 自定义需要处理的异常 // 自定义需要处理的异常
Configure<AbpExceptionHandlingOptions>(options => Configure<AbpExceptionHandlingOptions>(options =>
@ -264,6 +274,14 @@ public partial class RealtimeMessageHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
@ -278,6 +296,7 @@ public partial class RealtimeMessageHttpApiHostModule
{ {
// 宿主项目启用动态通知 // 宿主项目启用动态通知
options.IsDynamicNotificationsStoreEnabled = true; options.IsDynamicNotificationsStoreEnabled = true;
options.SaveStaticNotificationsToDatabase = false;
}); });
} }

9
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs

@ -34,6 +34,7 @@ using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using LINGYUN.Abp.TaskManagement.EntityFrameworkCore; using LINGYUN.Abp.TaskManagement.EntityFrameworkCore;
using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; using LINGYUN.Abp.TextTemplating.EntityFrameworkCore;
using LINGYUN.Abp.TextTemplating.Scriban;
using LY.MicroService.RealtimeMessage.EntityFrameworkCore; using LY.MicroService.RealtimeMessage.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -50,7 +51,6 @@ using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TextTemplating.Scriban;
namespace LY.MicroService.RealtimeMessage; namespace LY.MicroService.RealtimeMessage;
@ -95,7 +95,10 @@ namespace LY.MicroService.RealtimeMessage;
typeof(AbpNotificationsWeChatMiniProgramModule), typeof(AbpNotificationsWeChatMiniProgramModule),
typeof(AbpNotificationsWeChatWorkModule), typeof(AbpNotificationsWeChatWorkModule),
typeof(AbpNotificationsExceptionHandlingModule), typeof(AbpNotificationsExceptionHandlingModule),
// 重写模板引擎支持外部本地化
typeof(AbpTextTemplatingScribanModule), typeof(AbpTextTemplatingScribanModule),
typeof(AbpCAPEventBusModule), typeof(AbpCAPEventBusModule),
typeof(AbpFeaturesValidationRedisModule), typeof(AbpFeaturesValidationRedisModule),
typeof(AbpCachingStackExchangeRedisModule), typeof(AbpCachingStackExchangeRedisModule),
@ -126,11 +129,13 @@ public partial class RealtimeMessageHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();
ConfigureNotifications(); ConfigureNotifications();
ConfigureTextTemplating();
ConfigureBackgroundTasks(); ConfigureBackgroundTasks();
ConfigreExceptionHandling(); ConfigureExceptionHandling();
ConfigureVirtualFileSystem(); ConfigureVirtualFileSystem();
ConfigureFeatureManagement(); ConfigureFeatureManagement();
ConfigureCaching(configuration); ConfigureCaching(configuration);

9
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/TaskManagementHttpApiHostModule.Configure.cs

@ -24,6 +24,7 @@ using System.Collections.Generic;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -235,6 +236,14 @@ public partial class TaskManagementHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

1
aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/TaskManagementHttpApiHostModule.cs

@ -100,6 +100,7 @@ public partial class TaskManagementHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();
ConfigureBackgroundTasks(); ConfigureBackgroundTasks();

9
aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.Configure.cs

@ -32,6 +32,7 @@ using System.Collections.Generic;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -297,6 +298,14 @@ public partial class WebhooksManagementHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

1
aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/WebhooksManagementHttpApiHostModule.cs

@ -98,6 +98,7 @@ public partial class WebhooksManagementHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureWrapper(); ConfigureWrapper();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();

8
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.Configure.cs

@ -325,6 +325,14 @@ public partial class WorkflowManagementHttpApiHostModule
}); });
} }
private void ConfigureMvc()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ExposeIntegrationServices = true;
});
}
private void ConfigureVirtualFileSystem() private void ConfigureVirtualFileSystem()
{ {
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>

1
aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs

@ -102,6 +102,7 @@ public partial class WorkflowManagementHttpApiHostModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
ConfigureMvc();
ConfigureDbContext(); ConfigureDbContext();
ConfigureLocalization(); ConfigureLocalization();
ConfigureBackgroundTasks(); ConfigureBackgroundTasks();

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save