Browse Source

Refactor the setting-management module

pull/135/head
cKey 5 years ago
parent
commit
cdca549729
  1. 14
      aspnet-core/LINGYUN.MicroService.All.sln
  2. 48
      aspnet-core/LINGYUN.MicroService.BackendAdmin.sln
  3. 2
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs
  4. 2
      aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AbpAccountDomainSharedModule.cs
  5. 41
      aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml
  6. 4
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj
  7. 4
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/AccountSettingsDto.cs
  8. 14
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/FileManagementSettingsDto.cs
  9. 11
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/IdentitySettingGroupDto.cs
  10. 90
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/IdentitySettingsDto.cs
  11. 2
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/LocalizationSettingsDto.cs
  12. 19
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/OptionDto.cs
  13. 42
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDetailsDto.cs
  14. 40
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDto.cs
  15. 31
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingGroupDto.cs
  16. 10
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/TimingSettingsDto.cs
  17. 34
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs
  18. 17
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/ISettingAppService.cs
  19. 36
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Localization/ApplicationContracts/en.json
  20. 36
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Localization/ApplicationContracts/zh-Hans.json
  21. 4
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN.Abp.SettingManagement.Application.csproj
  22. 382
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs
  23. 54
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingController.cs
  24. 35
      aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/Settings/AccountSettingDefinitionProvider.cs
  25. 1
      vueJs/debug.log
  26. 106
      vueJs/src/api/settings.ts
  27. 14
      vueJs/src/views/admin/settings/components/GlobalSettingEditForm.vue
  28. 826
      vueJs/src/views/admin/settings/components/SettingEditForm.vue
  29. 14
      vueJs/src/views/admin/settings/components/TenantSettingEditForm.vue

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

@ -73,10 +73,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Applica
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Application", "modules\account\LINGYUN.Abp.Account.Application\LINGYUN.Abp.Account.Application.csproj", "{8E569C1C-2637-4D89-804C-50FBC83948FB}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Application", "modules\account\LINGYUN.Abp.Account.Application\LINGYUN.Abp.Account.Application.csproj", "{8E569C1C-2637-4D89-804C-50FBC83948FB}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Domain", "modules\account\LINGYUN.Abp.Account.Domain\LINGYUN.Abp.Account.Domain.csproj", "{79D3F30B-AB84-4E14-B721-6D8820C8443D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Domain.Shared", "modules\account\LINGYUN.Abp.Account.Domain.Shared\LINGYUN.Abp.Account.Domain.Shared.csproj", "{9CE1A399-E466-496C-8FCC-1DC25059C51F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.HttpApi", "modules\account\LINGYUN.Abp.Account.HttpApi\LINGYUN.Abp.Account.HttpApi.csproj", "{5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.HttpApi", "modules\account\LINGYUN.Abp.Account.HttpApi\LINGYUN.Abp.Account.HttpApi.csproj", "{5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Sms.Aliyun", "modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj", "{FF1839EA-FB6B-4ED5-9804-E40427046D35}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Sms.Aliyun", "modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj", "{FF1839EA-FB6B-4ED5-9804-E40427046D35}"
@ -365,14 +361,6 @@ Global
{8E569C1C-2637-4D89-804C-50FBC83948FB}.Debug|Any CPU.Build.0 = Debug|Any CPU {8E569C1C-2637-4D89-804C-50FBC83948FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E569C1C-2637-4D89-804C-50FBC83948FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {8E569C1C-2637-4D89-804C-50FBC83948FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E569C1C-2637-4D89-804C-50FBC83948FB}.Release|Any CPU.Build.0 = Release|Any CPU {8E569C1C-2637-4D89-804C-50FBC83948FB}.Release|Any CPU.Build.0 = Release|Any CPU
{79D3F30B-AB84-4E14-B721-6D8820C8443D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79D3F30B-AB84-4E14-B721-6D8820C8443D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79D3F30B-AB84-4E14-B721-6D8820C8443D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79D3F30B-AB84-4E14-B721-6D8820C8443D}.Release|Any CPU.Build.0 = Release|Any CPU
{9CE1A399-E466-496C-8FCC-1DC25059C51F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9CE1A399-E466-496C-8FCC-1DC25059C51F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CE1A399-E466-496C-8FCC-1DC25059C51F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CE1A399-E466-496C-8FCC-1DC25059C51F}.Release|Any CPU.Build.0 = Release|Any CPU
{5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}.Debug|Any CPU.Build.0 = Debug|Any CPU {5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}.Release|Any CPU.ActiveCfg = Release|Any CPU {5A10C02B-D12C-479C-9E7F-9A7D9DDD753D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -735,8 +723,6 @@ Global
{9E72FEB9-A626-4312-892B-CDD043879758} = {C5CAD011-DF84-4914-939C-0C029DCEF26F} {9E72FEB9-A626-4312-892B-CDD043879758} = {C5CAD011-DF84-4914-939C-0C029DCEF26F}
{8B09385A-719C-4B83-B61E-0ECD5D2734BD} = {9E72FEB9-A626-4312-892B-CDD043879758} {8B09385A-719C-4B83-B61E-0ECD5D2734BD} = {9E72FEB9-A626-4312-892B-CDD043879758}
{8E569C1C-2637-4D89-804C-50FBC83948FB} = {9E72FEB9-A626-4312-892B-CDD043879758} {8E569C1C-2637-4D89-804C-50FBC83948FB} = {9E72FEB9-A626-4312-892B-CDD043879758}
{79D3F30B-AB84-4E14-B721-6D8820C8443D} = {9E72FEB9-A626-4312-892B-CDD043879758}
{9CE1A399-E466-496C-8FCC-1DC25059C51F} = {9E72FEB9-A626-4312-892B-CDD043879758}
{5A10C02B-D12C-479C-9E7F-9A7D9DDD753D} = {9E72FEB9-A626-4312-892B-CDD043879758} {5A10C02B-D12C-479C-9E7F-9A7D9DDD753D} = {9E72FEB9-A626-4312-892B-CDD043879758}
{FF1839EA-FB6B-4ED5-9804-E40427046D35} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} {FF1839EA-FB6B-4ED5-9804-E40427046D35} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
{9FE2A95F-D7A3-4305-9E12-E955EF74CF8D} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} {9FE2A95F-D7A3-4305-9E12-E955EF74CF8D} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}

48
aspnet-core/LINGYUN.MicroService.BackendAdmin.sln

@ -43,6 +43,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "permissions-management", "p
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.PermissionManagement.Domain", "modules\permissions-management\LINGYUN.Abp.PermissionManagement.Domain\LINGYUN.Abp.PermissionManagement.Domain.csproj", "{7521486D-2144-4AFA-86AD-8E8021479DE6}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.PermissionManagement.Domain", "modules\permissions-management\LINGYUN.Abp.PermissionManagement.Domain\LINGYUN.Abp.PermissionManagement.Domain.csproj", "{7521486D-2144-4AFA-86AD-8E8021479DE6}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "file-management", "file-management", "{8F972C8E-F047-4883-A4BF-3423A2BAED36}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.FileManagement.Domain.Shared", "modules\file-management\LINGYUN.Abp.FileManagement.Domain.Shared\LINGYUN.Abp.FileManagement.Domain.Shared.csproj", "{49F8CD24-85EA-479A-A376-CC31A0618AE7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "account", "account", "{9DAD2CA8-16B6-4006-BD8E-EE3E9BAA3770}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.Application.Contracts", "modules\account\LINGYUN.Abp.Account.Application.Contracts\LINGYUN.Abp.Account.Application.Contracts.csproj", "{AA2F7243-976C-47F3-9B4E-20CC22F8FCF4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Identity.Domain.Shared", "modules\identity\LINGYUN.Abp.Identity.Domain.Shared\LINGYUN.Abp.Identity.Domain.Shared.csproj", "{E758D3A7-DB93-4EAC-A2ED-C2322D4F7D67}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Identity.Application.Contracts", "modules\identity\LINGYUN.Abp.Identity.Application.Contracts\LINGYUN.Abp.Identity.Application.Contracts.csproj", "{D4AB1BF0-95EC-4E34-9C39-E888ED30C535}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Account.HttpApi", "modules\account\LINGYUN.Abp.Account.HttpApi\LINGYUN.Abp.Account.HttpApi.csproj", "{A387EF32-1FAD-412F-893D-43485CE59DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Identity.Application", "modules\identity\LINGYUN.Abp.Identity.Application\LINGYUN.Abp.Identity.Application.csproj", "{9BABF219-AAAA-4611-8B49-BFCCBD046934}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -101,6 +117,30 @@ Global
{7521486D-2144-4AFA-86AD-8E8021479DE6}.Debug|Any CPU.Build.0 = Debug|Any CPU {7521486D-2144-4AFA-86AD-8E8021479DE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7521486D-2144-4AFA-86AD-8E8021479DE6}.Release|Any CPU.ActiveCfg = Release|Any CPU {7521486D-2144-4AFA-86AD-8E8021479DE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7521486D-2144-4AFA-86AD-8E8021479DE6}.Release|Any CPU.Build.0 = Release|Any CPU {7521486D-2144-4AFA-86AD-8E8021479DE6}.Release|Any CPU.Build.0 = Release|Any CPU
{49F8CD24-85EA-479A-A376-CC31A0618AE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49F8CD24-85EA-479A-A376-CC31A0618AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49F8CD24-85EA-479A-A376-CC31A0618AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49F8CD24-85EA-479A-A376-CC31A0618AE7}.Release|Any CPU.Build.0 = Release|Any CPU
{AA2F7243-976C-47F3-9B4E-20CC22F8FCF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA2F7243-976C-47F3-9B4E-20CC22F8FCF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA2F7243-976C-47F3-9B4E-20CC22F8FCF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA2F7243-976C-47F3-9B4E-20CC22F8FCF4}.Release|Any CPU.Build.0 = Release|Any CPU
{E758D3A7-DB93-4EAC-A2ED-C2322D4F7D67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E758D3A7-DB93-4EAC-A2ED-C2322D4F7D67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E758D3A7-DB93-4EAC-A2ED-C2322D4F7D67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E758D3A7-DB93-4EAC-A2ED-C2322D4F7D67}.Release|Any CPU.Build.0 = Release|Any CPU
{D4AB1BF0-95EC-4E34-9C39-E888ED30C535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4AB1BF0-95EC-4E34-9C39-E888ED30C535}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4AB1BF0-95EC-4E34-9C39-E888ED30C535}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4AB1BF0-95EC-4E34-9C39-E888ED30C535}.Release|Any CPU.Build.0 = Release|Any CPU
{A387EF32-1FAD-412F-893D-43485CE59DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A387EF32-1FAD-412F-893D-43485CE59DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A387EF32-1FAD-412F-893D-43485CE59DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A387EF32-1FAD-412F-893D-43485CE59DB4}.Release|Any CPU.Build.0 = Release|Any CPU
{9BABF219-AAAA-4611-8B49-BFCCBD046934}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BABF219-AAAA-4611-8B49-BFCCBD046934}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BABF219-AAAA-4611-8B49-BFCCBD046934}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BABF219-AAAA-4611-8B49-BFCCBD046934}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -124,6 +164,14 @@ Global
{376B2235-ADA7-4EC7-A27D-8F97EC6A57CD} = {2F56344F-6E06-4F9B-A0F2-8A6F0AEB096A} {376B2235-ADA7-4EC7-A27D-8F97EC6A57CD} = {2F56344F-6E06-4F9B-A0F2-8A6F0AEB096A}
{D25C4814-71AB-4A9D-8C76-298A7DE1A747} = {ED23B2F3-87C1-44B6-8906-9DE739422C2C} {D25C4814-71AB-4A9D-8C76-298A7DE1A747} = {ED23B2F3-87C1-44B6-8906-9DE739422C2C}
{7521486D-2144-4AFA-86AD-8E8021479DE6} = {D25C4814-71AB-4A9D-8C76-298A7DE1A747} {7521486D-2144-4AFA-86AD-8E8021479DE6} = {D25C4814-71AB-4A9D-8C76-298A7DE1A747}
{8F972C8E-F047-4883-A4BF-3423A2BAED36} = {ED23B2F3-87C1-44B6-8906-9DE739422C2C}
{49F8CD24-85EA-479A-A376-CC31A0618AE7} = {8F972C8E-F047-4883-A4BF-3423A2BAED36}
{9DAD2CA8-16B6-4006-BD8E-EE3E9BAA3770} = {ED23B2F3-87C1-44B6-8906-9DE739422C2C}
{AA2F7243-976C-47F3-9B4E-20CC22F8FCF4} = {9DAD2CA8-16B6-4006-BD8E-EE3E9BAA3770}
{E758D3A7-DB93-4EAC-A2ED-C2322D4F7D67} = {2F56344F-6E06-4F9B-A0F2-8A6F0AEB096A}
{D4AB1BF0-95EC-4E34-9C39-E888ED30C535} = {2F56344F-6E06-4F9B-A0F2-8A6F0AEB096A}
{A387EF32-1FAD-412F-893D-43485CE59DB4} = {9DAD2CA8-16B6-4006-BD8E-EE3E9BAA3770}
{9BABF219-AAAA-4611-8B49-BFCCBD046934} = {2F56344F-6E06-4F9B-A0F2-8A6F0AEB096A}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1573B900-87BA-4AD3-B785-6DD78127ADEF} SolutionGuid = {1573B900-87BA-4AD3-B785-6DD78127ADEF}

2
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs

@ -66,7 +66,7 @@ namespace LINGYUN.Abp.Account
var userName = input.UserName; var userName = input.UserName;
if (userName.IsNullOrWhiteSpace()) if (userName.IsNullOrWhiteSpace())
{ {
userName = "wxid-" + wehchatOpenId.OpenId.ToMd5(); userName = "wxid-" + wehchatOpenId.OpenId.ToMd5().ToLower();
} }
var userEmail = input.EmailAddress;//如果邮件地址不验证,随意写入一个 var userEmail = input.EmailAddress;//如果邮件地址不验证,随意写入一个

2
aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AbpAccountDomainSharedModule.cs

@ -1,4 +1,4 @@
using LINGYUN.Abp.Account.Localization; using Volo.Abp.Account.Localization;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;

41
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml

@ -59,7 +59,7 @@
Storage Storage
</summary> </summary>
</member> </member>
<member name="M:DotNetCore.CAP.Processor.AbpCapExpiresMessageCleanupBackgroundWorker.#ctor(Volo.Abp.Threading.AbpTimer,DotNetCore.CAP.Persistence.IDataStorage,DotNetCore.CAP.Persistence.IStorageInitializer,Microsoft.Extensions.Options.IOptions{LINGYUN.Abp.EventBus.CAP.MessageCleanupOptions},Microsoft.Extensions.DependencyInjection.IServiceScopeFactory)"> <member name="M:DotNetCore.CAP.Processor.AbpCapExpiresMessageCleanupBackgroundWorker.#ctor(Volo.Abp.Threading.AbpTimer,DotNetCore.CAP.Persistence.IDataStorage,DotNetCore.CAP.Persistence.IStorageInitializer,Microsoft.Extensions.Options.IOptions{LINGYUN.Abp.EventBus.CAP.AbpCAPEventBusOptions},Microsoft.Extensions.DependencyInjection.IServiceScopeFactory)">
<summary> <summary>
创建过期消息清理任务 创建过期消息清理任务
</summary> </summary>
@ -121,6 +121,28 @@
</summary> </summary>
<param name="context"></param> <param name="context"></param>
</member> </member>
<member name="T:LINGYUN.Abp.EventBus.CAP.AbpCAPEventBusOptions">
<summary>
过期消息清理配置项
</summary>
</member>
<member name="P:LINGYUN.Abp.EventBus.CAP.AbpCAPEventBusOptions.NotifyFailedCallback">
<summary>
发布消息处理失败通知
</summary>
</member>
<member name="P:LINGYUN.Abp.EventBus.CAP.AbpCAPEventBusOptions.CleanUpExpiresMessageBatch">
<summary>
批量清理数量
default: 1000
</summary>
</member>
<member name="P:LINGYUN.Abp.EventBus.CAP.AbpCAPEventBusOptions.CleanUpExpiresMessageInterval">
<summary>
执行间隔(ms)
default: 3600000 (1 hours)
</summary>
</member>
<member name="T:LINGYUN.Abp.EventBus.CAP.AbpCAPExecutionFailedException"> <member name="T:LINGYUN.Abp.EventBus.CAP.AbpCAPExecutionFailedException">
<summary> <summary>
AbpECAPExecutionFailedException AbpECAPExecutionFailedException
@ -277,23 +299,6 @@
<param name="eventType"></param> <param name="eventType"></param>
<param name="factory"></param> <param name="factory"></param>
</member> </member>
<member name="T:LINGYUN.Abp.EventBus.CAP.MessageCleanupOptions">
<summary>
过期消息清理配置项
</summary>
</member>
<member name="P:LINGYUN.Abp.EventBus.CAP.MessageCleanupOptions.ItemBatch">
<summary>
批量清理数量
default: 1000
</summary>
</member>
<member name="P:LINGYUN.Abp.EventBus.CAP.MessageCleanupOptions.Interval">
<summary>
执行间隔(ms)
default: 3600000 (1 hours)
</summary>
</member>
<member name="T:Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions"> <member name="T:Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions">
<summary> <summary>
CAP ServiceCollectionExtensions CAP ServiceCollectionExtensions

4
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj

@ -22,4 +22,8 @@
<PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="3.3.0" /> <PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="3.3.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\account\LINGYUN.Abp.Account.Application.Contracts\LINGYUN.Abp.Account.Application.Contracts.csproj" />
</ItemGroup>
</Project> </Project>

4
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/AccountSettingsDto.cs

@ -5,10 +5,10 @@
/// <summary> /// <summary>
/// 是否允许用户自行注册帐户 /// 是否允许用户自行注册帐户
/// </summary> /// </summary>
public bool IsSelfRegistrationEnabled { get; set; } public SettingDetailsDto IsSelfRegistrationEnabled { get; set; }
/// <summary> /// <summary>
/// 服务器是否将允许用户使用本地帐户进行身份验证 /// 服务器是否将允许用户使用本地帐户进行身份验证
/// </summary> /// </summary>
public bool EnableLocalLogin { get; set; } public SettingDetailsDto EnableLocalLogin { get; set; }
} }
} }

14
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/FileManagementSettingsDto.cs

@ -0,0 +1,14 @@
namespace LINGYUN.Abp.SettingManagement
{
public class FileManagementSettingsDto
{
/// <summary>
/// 限制上传文件大小
/// </summary>
public SettingDetailsDto FileLimitLength { get; set; }
/// <summary>
/// 允许的文件扩展名
/// </summary>
public SettingDetailsDto AllowFileExtensions { get; set; }
}
}

11
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/IdentitySettingGroupDto.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace LINGYUN.Abp.SettingManagement
{
public class IdentitySettingGroupDto
{
}
}

90
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/IdentitySettingsDto.cs

@ -1,83 +1,111 @@
using System; namespace LINGYUN.Abp.SettingManagement
using System.Collections.Generic;
using System.Text;
namespace LINGYUN.Abp.SettingManagement
{ {
public class IdentitySettingsDto public class PasswordDto
{
public IdentityPasswordSettings Password { get; set; }
public IdentityLockoutSettings Lockout { get; set; }
public IdentitySignInSettings SignIn { get; set; }
public IdentityUserSettings User { get; set; }
}
public class IdentityPasswordSettings
{ {
/// <summary> /// <summary>
/// 密码的最小长度 /// 密码的最小长度
/// </summary> /// </summary>
public int RequiredLength { get; set; } public SettingDetailsDto RequiredLength { get; set; }
/// <summary> /// <summary>
/// 密码必须包含唯一字符的数量 /// 密码必须包含唯一字符的数量
/// </summary> /// </summary>
public int RequiredUniqueChars { get; set; } public SettingDetailsDto RequiredUniqueChars { get; set; }
/// <summary> /// <summary>
/// 密码是否必须包含非字母数字 /// 密码是否必须包含非字母数字
/// </summary> /// </summary>
public bool RequireNonAlphanumeric { get; set; } public SettingDetailsDto RequireNonAlphanumeric { get; set; }
/// <summary> /// <summary>
/// 密码是否必须包含小写字母 /// 密码是否必须包含小写字母
/// </summary> /// </summary>
public bool RequireLowercase { get; set; } public SettingDetailsDto RequireLowercase { get; set; }
/// <summary> /// <summary>
/// 密码是否必须包含大写字母 /// 密码是否必须包含大写字母
/// </summary> /// </summary>
public bool RequireUppercase { get; set; } public SettingDetailsDto RequireUppercase { get; set; }
/// <summary> /// <summary>
/// 密码是否必须包含数字 /// 密码是否必须包含数字
/// </summary> /// </summary>
public bool RequireDigit { get; set; } public SettingDetailsDto RequireDigit { get; set; }
} }
public class IdentityLockoutSettings public class LockoutDto
{ {
/// <summary> /// <summary>
/// 允许新用户被锁定 /// 允许新用户被锁定
/// </summary> /// </summary>
public bool AllowedForNewUsers { get; set; } public SettingDetailsDto AllowedForNewUsers { get; set; }
/// <summary> /// <summary>
/// 当锁定发生时用户被的锁定的时间(秒) /// 当锁定发生时用户被的锁定的时间(秒)
/// </summary> /// </summary>
public int LockoutDuration { get; set; } public SettingDetailsDto LockoutDuration { get; set; }
/// <summary> /// <summary>
/// 如果启用锁定, 当用户被锁定前失败的访问尝试次数 /// 如果启用锁定, 当用户被锁定前失败的访问尝试次数
/// </summary> /// </summary>
public int MaxFailedAccessAttempts { get; set; } public SettingDetailsDto MaxFailedAccessAttempts { get; set; }
} }
public class IdentitySignInSettings public class SignInDto
{ {
/// <summary> /// <summary>
/// 登录时是否需要验证电子邮箱 /// 登录时是否需要验证电子邮箱
/// </summary> /// </summary>
public bool RequireConfirmedEmail { get; set; } public SettingDetailsDto RequireConfirmedEmail { get; set; }
/// <summary> /// <summary>
/// 用户是否可以确认手机号码 /// 用户是否可以确认手机号码
/// </summary> /// </summary>
public bool EnablePhoneNumberConfirmation { get; set; } public SettingDetailsDto EnablePhoneNumberConfirmation { get; set; }
/// <summary> /// <summary>
/// 登录时是否需要验证手机号码 /// 登录时是否需要验证手机号码
/// </summary> /// </summary>
public bool RequireConfirmedPhoneNumber { get; set; } public SettingDetailsDto RequireConfirmedPhoneNumber { get; set; }
} }
public class IdentityUserSettings public class UserDto
{ {
/// <summary> /// <summary>
/// 是否允许用户更新用户名 /// 是否允许用户更新用户名
/// </summary> /// </summary>
public bool IsUserNameUpdateEnabled { get; set; } public SettingDetailsDto IsUserNameUpdateEnabled { get; set; }
/// <summary> /// <summary>
/// 是否允许用户更新电子邮箱 /// 是否允许用户更新电子邮箱
/// </summary> /// </summary>
public bool IsEmailUpdateEnabled { get; set; } public SettingDetailsDto IsEmailUpdateEnabled { get; set; }
/// <summary>
/// 用户注册短信验证码模板号
/// </summary>
public SettingDetailsDto SmsNewUserRegister { get; set; }
/// <summary>
/// 用户登录短信验证码模板号
/// </summary>
public SettingDetailsDto SmsUserSignin { get; set; }
/// <summary>
/// 用户重置密码短信验证码模板号
/// </summary>
public SettingDetailsDto SmsResetPassword { get; set; }
/// <summary>
/// 验证码重复间隔时间
/// </summary>
public SettingDetailsDto SmsRepetInterval { get; set; }
/// <summary>
/// 用户手机验证短信模板
/// </summary>
public SettingDetailsDto SmsPhoneNumberConfirmed { get; set; }
}
public class OrganizationUnitDto
{
/// <summary>
/// 单个用户最大组织机构数量
/// </summary>
public SettingDetailsDto MaxUserMembershipCount { get; set; }
}
public class TwoFactorDto
{
/// <summary>
/// 双因素认证行为
/// </summary>
public SettingDetailsDto Behaviour { get; set; }
/// <summary>
/// 用户是否可以变更双因素模式
/// </summary>
public SettingDetailsDto UsersCanChange { get; set; }
} }
} }

2
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/LocalizationSettingsDto.cs

@ -5,6 +5,6 @@
/// <summary> /// <summary>
/// 应用程序的默认语言 /// 应用程序的默认语言
/// </summary> /// </summary>
public string DefaultLanguage { get; set; } public SettingDetailsDto DefaultLanguage { get; set; }
} }
} }

19
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/OptionDto.cs

@ -0,0 +1,19 @@
namespace LINGYUN.Abp.SettingManagement
{
public class OptionDto
{
public string Name { get; set; }
public string Value { get; set; }
public OptionDto()
{
}
public OptionDto(string name, string value)
{
Name = name;
Value = value;
}
}
}

42
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDetailsDto.cs

@ -0,0 +1,42 @@
using System.Collections.Generic;
namespace LINGYUN.Abp.SettingManagement
{
public class SettingDetailsDto
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public string Value { get; set; }
public string DefaultValue { get; set; }
public bool IsEncrypted { get; set; }
public ValueType ValueType { get; set; }
/// <summary>
/// 选项列表,仅当 ValueType 为 Option有效
/// </summary>
public List<OptionDto> Options { get; set; } = new List<OptionDto>();
public SettingDetailsDto AddOption(string name, string value)
{
Options.Add(new OptionDto
{
Name = name,
Value = value
});
return this;
}
public SettingDetailsDto AddOptions(IEnumerable<OptionDto> options)
{
Options.AddRange(options);
return this;
}
}
}

40
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDto.cs

@ -1,15 +1,43 @@
namespace LINGYUN.Abp.SettingManagement using Microsoft.Extensions.Localization;
using System.Collections.Generic;
using Volo.Abp.Settings;
namespace LINGYUN.Abp.SettingManagement
{ {
public class SettingDto public class SettingDto
{ {
public string Name { get; set; }
public string DisplayName { get; set; } public string DisplayName { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Value { get; set; } public List<SettingDetailsDto> Details { get; set; } = new List<SettingDetailsDto>();
public SettingDto()
{
}
public SettingDto(string displayName, string description = "")
{
DisplayName = displayName;
Description = description;
}
public SettingDetailsDto AddDetail(SettingDefinition setting, IStringLocalizerFactory factory, string value, ValueType type)
{
var detail = new SettingDetailsDto()
{
DefaultValue = setting.DefaultValue,
IsEncrypted = setting.IsEncrypted,
Description = setting.Description.Localize(factory),
DisplayName = setting.DisplayName.Localize(factory),
Name = setting.Name,
Value = value,
ValueType = type
};
Details.Add(detail);
public string DefaultValue { get; set; } return detail;
}
} }
} }

31
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingGroupDto.cs

@ -0,0 +1,31 @@
using System.Collections.Generic;
namespace LINGYUN.Abp.SettingManagement
{
public class SettingGroupDto
{
public string DisplayName { get; set; }
public string Description { get; set; }
public List<SettingDto> Settings { get; set; } = new List<SettingDto>();
public SettingGroupDto()
{
}
public SettingGroupDto(string displayName, string description = "")
{
DisplayName = displayName;
Description = description;
}
public SettingDto AddSetting(string displayName, string description = "")
{
var setting = new SettingDto(displayName, description);
Settings.Add(setting);
return setting;
}
}
}

10
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/TimingSettingsDto.cs

@ -0,0 +1,10 @@
namespace LINGYUN.Abp.SettingManagement
{
public class TimingSettingsDto
{
/// <summary>
/// 时区
/// </summary>
public string TimeZone { get; set; }
}
}

34
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs

@ -0,0 +1,34 @@
namespace LINGYUN.Abp.SettingManagement
{
public enum ValueType
{
/// <summary>
/// 字符
/// </summary>
String = 0,
/// <summary>
/// 数字
/// </summary>
Number = 1,
/// <summary>
/// 布尔
/// </summary>
Boolean = 2,
/// <summary>
/// 日期
/// </summary>
Date = 3,
/// <summary>
/// 数组
/// </summary>
Array = 4,
/// <summary>
/// 选项
/// </summary>
Option = 5,
/// <summary>
/// 对象
/// </summary>
Object = 10
}
}

17
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/ISettingAppService.cs

@ -1,7 +1,4 @@
using JetBrains.Annotations; using System.Threading.Tasks;
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
@ -9,20 +6,12 @@ namespace LINGYUN.Abp.SettingManagement
{ {
public interface ISettingAppService : IApplicationService public interface ISettingAppService : IApplicationService
{ {
Task<ListResultDto<SettingDto>> GetAllGlobalAsync();
Task SetGlobalAsync(UpdateSettingsDto input); Task SetGlobalAsync(UpdateSettingsDto input);
Task<ListResultDto<SettingDto>> GetAllForCurrentTenantAsync();
Task SetCurrentTenantAsync(UpdateSettingsDto input); Task SetCurrentTenantAsync(UpdateSettingsDto input);
Task<ListResultDto<SettingDto>> GetAllForUserAsync([Required] Guid userId); Task<ListResultDto<SettingGroupDto>> GetAllForGlobalAsync();
Task SetForUserAsync([Required] Guid userId, UpdateSettingsDto input);
Task<ListResultDto<SettingDto>> GetAllForCurrentUserAsync();
Task SetCurrentUserAsync(UpdateSettingsDto input); Task<ListResultDto<SettingGroupDto>> GetAllForCurrentTenantAsync();
} }
} }

36
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Localization/ApplicationContracts/en.json

@ -4,6 +4,40 @@
"Permission:SettingManagement": "SettingManagement", "Permission:SettingManagement": "SettingManagement",
"Permission:Settings": "Settings", "Permission:Settings": "Settings",
"Permission:Update": "Update", "Permission:Update": "Update",
"Permission:Manager": "Manager" "Permission:Manager": "Manager",
"DisplayName:System": "System",
"Description:System": "System",
"DisplayName:System.Language": "Language",
"Description:System.Language": "Language",
"DisplayName:System.Timing": "Timing",
"Description:System.Timing": "Timing",
"DisplayName:Security": "Security",
"Description:Security": "Security",
"DisplayName:Security.Account": "Account",
"Description:Security.Account": "Account",
"DisplayName:Identity": "Identity",
"Description:Identity": "Identity",
"DisplayName:Identity.Lockout": "Lockout",
"Description:Identity.Lockout": "Lockout",
"DisplayName:Identity.User": "User",
"Description:Identity.User": "User",
"DisplayName:Identity.SignIn": "SignIn",
"Description:Identity.SignIn": "SignIn",
"DisplayName:Identity.Password": "Password",
"Description:Identity.Password": "Password",
"DisplayName:Identity.TwoFactor": "TwoFactor",
"Description:Identity.TwoFactor": "TwoFactor",
"DisplayName:Identity.OrganizationUnit": "OrganizationUnit",
"Description:Identity.OrganizationUnit": "OrganizationUnit",
"DisplayName:Emailing": "Emailing",
"Description:Emailing": "Emailing",
"DisplayName:Emailing.Default": "Default",
"Description:Emailing.Default": "Default",
"DisplayName:Emailing.Smtp": "Smtp",
"Description:Emailing.Smtp": "Smtp",
"DisplayName:FileManagement": "File Management",
"Description:FileManagement": "File Management",
"DisplayName:FileManagement.FileSystem": "File System",
"Description:FileManagement.FileSystem": "File System"
} }
} }

36
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Localization/ApplicationContracts/zh-Hans.json

@ -4,6 +4,40 @@
"Permission:SettingManagement": "系统设置", "Permission:SettingManagement": "系统设置",
"Permission:Settings": "配置管理", "Permission:Settings": "配置管理",
"Permission:Update": "变更", "Permission:Update": "变更",
"Permission:Manager": "管理" "Permission:Manager": "管理",
"DisplayName:System": "系统设置",
"Description:System": "与系统相关的配置项",
"DisplayName:System.Language": "语言",
"Description:System.Language": "应用程序的多语言配置",
"DisplayName:System.Timing": "时区",
"Description:System.Timing": "应用程序的时区配置",
"DisplayName:Security": "安全设置",
"Description:Security": "与应用安全相关的配置",
"DisplayName:Security.Account": "用户账户",
"Description:Security.Account": "管理用户账户配置",
"DisplayName:Identity": "身份认证",
"Description:Identity": "应用程序身份认证相关配置",
"DisplayName:Identity.Lockout": "用户锁定",
"Description:Identity.Lockout": "当用户登录失败达到上限的锁定策略",
"DisplayName:Identity.User": "用户配置",
"Description:Identity.User": "用户配置",
"DisplayName:Identity.SignIn": "用户登录",
"Description:Identity.SignIn": "用户登录有关的策略配置",
"DisplayName:Identity.Password": "密码配置",
"Description:Identity.Password": "用户密码配置策略",
"DisplayName:Identity.TwoFactor": "双因素配置",
"Description:Identity.TwoFactor": "双因素认证配置策略",
"DisplayName:Identity.OrganizationUnit": "组织机构",
"Description:Identity.OrganizationUnit": "组织机构配置策略",
"DisplayName:Emailing": "邮件设置",
"Description:Emailing": "邮件通知相关的配置",
"DisplayName:Emailing.Default": "默认配置",
"Description:Emailing.Default": "邮件通知的默认配置",
"DisplayName:Emailing.Smtp": "Smtp配置",
"Description:Emailing.Smtp": "Smtp配置",
"DisplayName:FileManagement": "文件管理",
"Description:FileManagement": "文件管理",
"DisplayName:FileManagement.FileSystem": "文件系统",
"Description:FileManagement.FileSystem": "文件系统"
} }
} }

4
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN.Abp.SettingManagement.Application.csproj

@ -7,10 +7,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Emailing" Version="3.3.0" />
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="3.3.0" /> <PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="3.3.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\account\LINGYUN.Abp.Account.Application.Contracts\LINGYUN.Abp.Account.Application.Contracts.csproj" />
<ProjectReference Include="..\..\file-management\LINGYUN.Abp.FileManagement.Domain.Shared\LINGYUN.Abp.FileManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\identity\LINGYUN.Abp.Identity.Domain.Shared\LINGYUN.Abp.Identity.Domain.Shared.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" />
</ItemGroup> </ItemGroup>

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

@ -1,16 +1,24 @@
using Microsoft.AspNetCore.Authorization; using LINGYUN.Abp.FileManagement.Settings;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Account.Settings;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.Emailing;
using Volo.Abp.Identity.Features;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.SettingManagement; using Volo.Abp.SettingManagement;
using Volo.Abp.SettingManagement.Localization; using Volo.Abp.SettingManagement.Localization;
using Volo.Abp.Settings; using Volo.Abp.Settings;
using Volo.Abp.Timing;
using Volo.Abp.Users; using Volo.Abp.Users;
namespace LINGYUN.Abp.SettingManagement namespace LINGYUN.Abp.SettingManagement
@ -18,6 +26,8 @@ namespace LINGYUN.Abp.SettingManagement
[Authorize(AbpSettingManagementPermissions.Settings.Default)] [Authorize(AbpSettingManagementPermissions.Settings.Default)]
public class SettingAppService : ApplicationService, ISettingAppService public class SettingAppService : ApplicationService, ISettingAppService
{ {
protected AbpLocalizationOptions LocalizationOptions { get; }
protected ISettingManager SettingManager { get; } protected ISettingManager SettingManager { get; }
protected ISettingDefinitionManager SettingDefinitionManager { get; } protected ISettingDefinitionManager SettingDefinitionManager { get; }
@ -25,11 +35,13 @@ namespace LINGYUN.Abp.SettingManagement
public SettingAppService( public SettingAppService(
ISettingManager settingManager, ISettingManager settingManager,
IDistributedCache<SettingCacheItem> cache, IDistributedCache<SettingCacheItem> cache,
IOptions<AbpLocalizationOptions> localizationOptions,
ISettingDefinitionManager settingDefinitionManager) ISettingDefinitionManager settingDefinitionManager)
{ {
Cache = cache; Cache = cache;
SettingManager = settingManager; SettingManager = settingManager;
SettingDefinitionManager = settingDefinitionManager; SettingDefinitionManager = settingDefinitionManager;
LocalizationOptions = localizationOptions.Value;
LocalizationResource = typeof(AbpSettingManagementResource); LocalizationResource = typeof(AbpSettingManagementResource);
} }
@ -58,108 +70,312 @@ namespace LINGYUN.Abp.SettingManagement
} }
} }
[Authorize(AbpSettingManagementPermissions.Settings.Manager)]
public virtual async Task SetForUserAsync([Required] Guid userId, UpdateSettingsDto input)
{
foreach (var setting in input.Settings)
{
await SettingManager.SetForUserAsync(userId, setting.Name, setting.Value);
}
await CurrentUnitOfWork.SaveChangesAsync();
}
[Authorize] [Authorize]
public virtual async Task SetCurrentUserAsync(UpdateSettingsDto input) public virtual async Task<ListResultDto<SettingGroupDto>> GetAllForCurrentTenantAsync()
{ {
foreach (var setting in input.Settings) return await GetAllForProviderAsync(TenantSettingValueProvider.ProviderName, CurrentTenant.GetId().ToString());
{
await SettingManager.SetForUserAsync(CurrentUser.GetId(), setting.Name, setting.Value);
}
await CurrentUnitOfWork.SaveChangesAsync();
} }
[AllowAnonymous] [AllowAnonymous]
public virtual async Task<ListResultDto<SettingDto>> GetAllGlobalAsync() public virtual async Task<ListResultDto<SettingGroupDto>> GetAllForGlobalAsync()
{ {
// return GetAllSetting(await SettingManager.GetAllGlobalAsync()); return await GetAllForProviderAsync(GlobalSettingValueProvider.ProviderName, null);
return await GetAllSettingAsync(GlobalSettingValueProvider.ProviderName, null);
} }
public virtual async Task<ListResultDto<SettingDto>> GetAllForCurrentTenantAsync() protected virtual async Task<ListResultDto<SettingGroupDto>> GetAllForProviderAsync(string providerName, string providerKey)
{ {
if (CurrentTenant.IsAvailable) /*
{ * 2020-11-19
// return GetAllSetting(await SettingManager.GetAllForTenantAsync(CurrentTenant.GetId(), false)); * colin@foxmail.com
*
* ,
*
* Dto的配置服务,,
* (vue前端已设计为动态表单页面)
*
* ,,
*/
return await GetAllSettingAsync(TenantSettingValueProvider.ProviderName, CurrentTenant.GetId().ToString()); var settingGroups = new List<SettingGroupDto>();
}
return new ListResultDto<SettingDto>();
} #region 系统设置
public virtual async Task<ListResultDto<SettingDto>> GetAllForUserAsync([Required] Guid userId) var sysSettingGroup = new SettingGroupDto(L["DisplayName:System"], L["Description:System"]);
{ // 语言
// return GetAllSetting(await SettingManager.GetAllForUserAsync(userId)); var languageSetting = sysSettingGroup.AddSetting(L["DisplayName:System.Language"], L["Description:System.Language"]);
languageSetting.AddDetail(
SettingDefinitionManager.Get(LocalizationSettingNames.DefaultLanguage),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage, providerName, providerKey),
ValueType.Option)
.AddOptions(LocalizationOptions.Languages.Select(l => new OptionDto(l.DisplayName, l.CultureName)));
// 时区
var timingSetting = sysSettingGroup.AddSetting(L["DisplayName:System.Timing"], L["Description:System.Timing"]);
timingSetting.AddDetail(
SettingDefinitionManager.Get(TimingSettingNames.TimeZone),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(TimingSettingNames.TimeZone, providerName, providerKey),
ValueType.String);
settingGroups.Add(sysSettingGroup);
return await GetAllSettingAsync(UserSettingValueProvider.ProviderName, userId.ToString()); #endregion
}
[Authorize] #region 安全设置
public virtual async Task<ListResultDto<SettingDto>> GetAllForCurrentUserAsync()
{
// return GetAllSetting(await SettingManager.GetAllForUserAsync(CurrentUser.GetId()));
return await GetAllSettingAsync(UserSettingValueProvider.ProviderName, CurrentUser.GetId().ToString()); var securitySettingGroup = new SettingGroupDto(L["DisplayName:Security"], L["Description:Security"]);
}
protected virtual ListResultDto<SettingDto> GetAllSetting(List<SettingValue> settings) // 用户账户
{ var accountSetting = securitySettingGroup.AddSetting(L["DisplayName:Security.Account"], L["Description:Security.Account"]);
var settingsDto = new List<SettingDto>(); // 启用本地登录
foreach (var setting in settings) accountSetting.AddDetail(
{ SettingDefinitionManager.Get(AccountSettingNames.EnableLocalLogin),
var settingDefinition = SettingDefinitionManager.Get(setting.Name); StringLocalizerFactory,
var settingInfo = new SettingDto await SettingManager.GetOrNullAsync(AccountSettingNames.EnableLocalLogin, providerName, providerKey),
{ ValueType.Boolean);
Name = setting.Name, accountSetting.AddDetail(
Value = setting.Value ?? settingDefinition.DefaultValue, SettingDefinitionManager.Get(AccountSettingNames.IsSelfRegistrationEnabled),
DefaultValue = settingDefinition.DefaultValue, StringLocalizerFactory,
Description = settingDefinition.Description.Localize(StringLocalizerFactory), await SettingManager.GetOrNullAsync(AccountSettingNames.IsSelfRegistrationEnabled, providerName, providerKey),
DisplayName = settingDefinition.DisplayName.Localize(StringLocalizerFactory) ValueType.Boolean);
};
settingsDto.Add(settingInfo);
}
return new ListResultDto<SettingDto>(settingsDto); settingGroups.Add(securitySettingGroup);
}
protected virtual async Task<ListResultDto<SettingDto>> GetAllSettingAsync(string providerName, string providerKey) #endregion
{
var settingsDto = new List<SettingDto>();
var settings = await SettingManager.GetAllAsync(providerName, providerKey); #region 身份标识设置
foreach (var setting in settings)
{ // 身份标识设置
var settingDefinition = SettingDefinitionManager.Get(setting.Name); var identitySetting = new SettingGroupDto(L["DisplayName:Identity"], L["Description:Identity"]);
if (settingDefinition.Providers.Count > 0 &&
!settingDefinition.Providers.Any(p => p.Equals(providerName))) #region 用户锁定
{
continue; var lockoutSetting = identitySetting.AddSetting(L["DisplayName:Identity.Lockout"], L["Description:Identity.Lockout"]);
} lockoutSetting.AddDetail(
var settingInfo = new SettingDto SettingDefinitionManager.Get(IdentitySettingNames.Lockout.AllowedForNewUsers),
{ StringLocalizerFactory,
Name = setting.Name, await SettingManager.GetOrNullAsync(IdentitySettingNames.Lockout.AllowedForNewUsers, providerName, providerKey),
Value = setting.Value ?? settingDefinition.DefaultValue, ValueType.Boolean);
DefaultValue = settingDefinition.DefaultValue, lockoutSetting.AddDetail(
Description = settingDefinition.Description.Localize(StringLocalizerFactory), SettingDefinitionManager.Get(IdentitySettingNames.Lockout.LockoutDuration),
DisplayName = settingDefinition.DisplayName.Localize(StringLocalizerFactory) StringLocalizerFactory,
}; await SettingManager.GetOrNullAsync(IdentitySettingNames.Lockout.LockoutDuration, providerName, providerKey),
settingsDto.Add(settingInfo); ValueType.Number);
} lockoutSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.Lockout.MaxFailedAccessAttempts),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, providerName, providerKey),
ValueType.Number);
#endregion
#region 用户
var userSetting = identitySetting.AddSetting(L["DisplayName:Identity.User"], L["Description:Identity.User"]);
userSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.User.IsEmailUpdateEnabled),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.User.IsEmailUpdateEnabled, providerName, providerKey),
ValueType.Boolean);
userSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.User.IsUserNameUpdateEnabled),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled, providerName, providerKey),
ValueType.Boolean);
userSetting.AddDetail(
SettingDefinitionManager.Get(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsNewUserRegister),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsNewUserRegister, providerName, providerKey),
ValueType.String);
userSetting.AddDetail(
SettingDefinitionManager.Get(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsResetPassword),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsResetPassword, providerName, providerKey),
ValueType.String);
userSetting.AddDetail(
SettingDefinitionManager.Get(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsUserSignin),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsUserSignin, providerName, providerKey),
ValueType.String);
userSetting.AddDetail(
SettingDefinitionManager.Get(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsPhoneNumberConfirmed),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsPhoneNumberConfirmed, providerName, providerKey),
ValueType.String);
userSetting.AddDetail(
SettingDefinitionManager.Get(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsRepetInterval),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(LINGYUN.Abp.Identity.Settings.IdentitySettingNames.User.SmsRepetInterval, providerName, providerKey),
ValueType.Number);
#endregion
#region 登录
var signinSetting = identitySetting.AddSetting(L["DisplayName:Identity.SignIn"], L["Description:Identity.SignIn"]);
signinSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.SignIn.EnablePhoneNumberConfirmation),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.SignIn.EnablePhoneNumberConfirmation, providerName, providerKey),
ValueType.Boolean);
signinSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.SignIn.RequireConfirmedEmail),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.SignIn.RequireConfirmedEmail, providerName, providerKey),
ValueType.Boolean);
signinSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, providerName, providerKey),
ValueType.Boolean);
#endregion
#region 密码
var passwordSetting = identitySetting.AddSetting(L["DisplayName:Identity.Password"], L["Description:Identity.Password"]);
passwordSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.Password.RequireDigit),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.Password.RequireDigit, providerName, providerKey),
ValueType.Boolean);
passwordSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.Password.RequiredLength),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.Password.RequiredLength, providerName, providerKey),
ValueType.Number);
passwordSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.Password.RequiredUniqueChars),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.Password.RequiredUniqueChars, providerName, providerKey),
ValueType.Number);
passwordSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.Password.RequireLowercase),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.Password.RequireLowercase, providerName, providerKey),
ValueType.Boolean);
passwordSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.Password.RequireUppercase),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.Password.RequireUppercase, providerName, providerKey),
ValueType.Boolean);
passwordSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.Password.RequireNonAlphanumeric),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.Password.RequireNonAlphanumeric, providerName, providerKey),
ValueType.Boolean);
#endregion
#region 双因素
var twoFactorSetting = identitySetting.AddSetting(L["DisplayName:Identity.TwoFactor"], L["Description:Identity.TwoFactor"]);
twoFactorSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.TwoFactor.Behaviour),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.TwoFactor.Behaviour, providerName, providerKey),
ValueType.Option)
.AddOption(IdentityTwoFactorBehaviour.Optional.ToString(), IdentityTwoFactorBehaviour.Optional.ToString())
.AddOption(IdentityTwoFactorBehaviour.Forced.ToString(), IdentityTwoFactorBehaviour.Forced.ToString())
.AddOption(IdentityTwoFactorBehaviour.Disabled.ToString(), IdentityTwoFactorBehaviour.Disabled.ToString());
twoFactorSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.TwoFactor.UsersCanChange),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.TwoFactor.UsersCanChange, providerName, providerKey),
ValueType.Boolean);
#endregion
#region 组织机构
var ouSetting = identitySetting.AddSetting(L["DisplayName:Identity.OrganizationUnit"], L["Description:Identity.OrganizationUnit"]);
ouSetting.AddDetail(
SettingDefinitionManager.Get(IdentitySettingNames.OrganizationUnit.MaxUserMembershipCount),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(IdentitySettingNames.OrganizationUnit.MaxUserMembershipCount, providerName, providerKey),
ValueType.Number);
settingGroups.Add(identitySetting);
#endregion
#endregion
#region 邮件设置
var emailSettingGroup = new SettingGroupDto(L["DisplayName:Emailing"], L["Description:Emailing"]);
var defaultMailSetting = emailSettingGroup.AddSetting(L["DisplayName:Emailing.Default"], L["Description:Emailing.Default"]);
defaultMailSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.DefaultFromAddress),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.DefaultFromAddress, providerName, providerKey),
ValueType.String);
defaultMailSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.DefaultFromDisplayName),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.DefaultFromDisplayName, providerName, providerKey),
ValueType.String);
var smtpSetting = emailSettingGroup.AddSetting(L["DisplayName:Emailing.Smtp"], L["Description:Emailing.Smtp"]);
smtpSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.Smtp.EnableSsl),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.EnableSsl, providerName, providerKey),
ValueType.Boolean);
smtpSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.Smtp.UseDefaultCredentials),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.UseDefaultCredentials, providerName, providerKey),
ValueType.Boolean);
smtpSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.Smtp.Domain),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Domain, providerName, providerKey),
ValueType.String);
smtpSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.Smtp.Host),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Host, providerName, providerKey),
ValueType.String);
smtpSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.Smtp.Port),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Port, providerName, providerKey),
ValueType.Number);
smtpSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.Smtp.UserName),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.UserName, providerName, providerKey),
ValueType.String);
smtpSetting.AddDetail(
SettingDefinitionManager.Get(EmailSettingNames.Smtp.Password),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(EmailSettingNames.Smtp.Password, providerName, providerKey),
ValueType.String);
settingGroups.Add(emailSettingGroup);
#endregion
#region 文件设置
var fileSettingGroup = new SettingGroupDto(L["DisplayName:FileManagement"], L["Description:FileManagement"]);
var fileSystemSetting = fileSettingGroup.AddSetting(L["DisplayName:FileManagement.FileSystem"], L["Description:FileManagement.FileSystem"]);
fileSystemSetting.AddDetail(
SettingDefinitionManager.Get(AbpFileManagementSettingNames.FileLimitLength),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(AbpFileManagementSettingNames.FileLimitLength, providerName, providerKey),
ValueType.Number);
fileSystemSetting.AddDetail(
SettingDefinitionManager.Get(AbpFileManagementSettingNames.AllowFileExtensions),
StringLocalizerFactory,
await SettingManager.GetOrNullAsync(AbpFileManagementSettingNames.AllowFileExtensions, providerName, providerKey),
ValueType.String);
settingGroups.Add(fileSettingGroup);
#endregion
return new ListResultDto<SettingDto>(settingsDto); return new ListResultDto<SettingGroupDto>(settingGroups);
} }
} }
} }

54
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingController.cs

@ -1,6 +1,4 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
@ -19,60 +17,32 @@ namespace LINGYUN.Abp.SettingManagement
_settingAppService = settingAppService; _settingAppService = settingAppService;
} }
[HttpGet] [HttpPut]
[Route("by-current-user")]
public virtual async Task<ListResultDto<SettingDto>> GetAllForCurrentUserAsync()
{
return await _settingAppService.GetAllForCurrentUserAsync();
}
[HttpGet]
[Route("by-current-tenant")] [Route("by-current-tenant")]
public virtual async Task<ListResultDto<SettingDto>> GetAllForCurrentTenantAsync() public virtual async Task SetCurrentTenantAsync(UpdateSettingsDto input)
{ {
return await _settingAppService.GetAllForCurrentTenantAsync(); await _settingAppService.SetCurrentTenantAsync(input);
} }
[HttpGet] [HttpPut]
[Route("by-user/{userId}")] [Route("by-global")]
public virtual async Task<ListResultDto<SettingDto>> GetAllForUserAsync([Required] Guid userId) public virtual async Task SetGlobalAsync(UpdateSettingsDto input)
{ {
return await _settingAppService.GetAllForUserAsync(userId); await _settingAppService.SetGlobalAsync(input);
} }
[HttpGet] [HttpGet]
[Route("by-global")] [Route("by-global")]
public virtual async Task<ListResultDto<SettingDto>> GetAllGlobalAsync() public virtual async Task<ListResultDto<SettingGroupDto>> GetAllForGlobalAsync()
{
return await _settingAppService.GetAllGlobalAsync();
}
[HttpPut]
[Route("by-current-user")]
public virtual async Task SetCurrentUserAsync(UpdateSettingsDto input)
{ {
await _settingAppService.SetCurrentUserAsync(input); return await _settingAppService.GetAllForGlobalAsync();
} }
[HttpPut] [HttpGet]
[Route("by-current-tenant")] [Route("by-current-tenant")]
public virtual async Task SetCurrentTenantAsync(UpdateSettingsDto input) public virtual async Task<ListResultDto<SettingGroupDto>> GetAllForCurrentTenantAsync()
{
await _settingAppService.SetCurrentTenantAsync(input);
}
[HttpPut]
[Route("by-user/{userId}")]
public virtual async Task SetForUserAsync([Required] Guid userId, UpdateSettingsDto input)
{ {
await _settingAppService.SetForUserAsync(userId, input); return await _settingAppService.GetAllForCurrentTenantAsync();
}
[HttpPut]
[Route("by-global")]
public virtual async Task SetGlobalAsync(UpdateSettingsDto input)
{
await _settingAppService.SetGlobalAsync(input);
} }
} }
} }

35
aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/Settings/AccountSettingDefinitionProvider.cs

@ -0,0 +1,35 @@
using Volo.Abp.Account.Localization;
using Volo.Abp.Account.Settings;
using Volo.Abp.Localization;
using Volo.Abp.Settings;
namespace LINGYUN.Abp.BackendAdmin.Settings
{
// 后台管理项目不引用 Volo.Abp.Account.Application模块,只能自建一个配置
public class AccountSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
context.Add(
new SettingDefinition(
AccountSettingNames.IsSelfRegistrationEnabled,
"true",
L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"),
L("Description:Abp.Account.IsSelfRegistrationEnabled"), isVisibleToClients: true)
);
context.Add(
new SettingDefinition(
AccountSettingNames.EnableLocalLogin,
"true",
L("DisplayName:Abp.Account.EnableLocalLogin"),
L("Description:Abp.Account.EnableLocalLogin"), isVisibleToClients: true)
);
}
private static LocalizableString L(string name)
{
return LocalizableString.Create<AccountResource>(name);
}
}
}

1
vueJs/debug.log

@ -0,0 +1 @@
[1119/165237.273:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)

106
vueJs/src/api/settings.ts

@ -9,7 +9,7 @@ export default class SettingApiService {
*/ */
public static getGlobalSettings() { public static getGlobalSettings() {
const _url = '/api/setting-management/settings/by-global' const _url = '/api/setting-management/settings/by-global'
return ApiService.Get<ListResultDto<Setting>>(_url, IdentityService) return ApiService.Get<ListResultDto<SettingGroup>>(_url, IdentityService)
} }
/** /**
@ -25,7 +25,7 @@ export default class SettingApiService {
*/ */
public static getCurrentTenantSettings() { public static getCurrentTenantSettings() {
const _url = '/api/setting-management/settings/by-current-tenant' const _url = '/api/setting-management/settings/by-current-tenant'
return ApiService.Get<ListResultDto<Setting>>(_url, IdentityService) return ApiService.Get<ListResultDto<SettingGroup>>(_url, IdentityService)
} }
/** /**
@ -36,38 +36,6 @@ export default class SettingApiService {
return ApiService.Put<any>(_url, payload, IdentityService) return ApiService.Put<any>(_url, payload, IdentityService)
} }
/**
*
*/
public static getCurrentUserSettings() {
const _url = '/api/setting-management/settings/by-current-user'
return ApiService.Get<ListResultDto<Setting>>(_url, IdentityService)
}
/**
*
*/
public static setCurrentUserSettings(payload: SettingsUpdate) {
const _url = '/api/setting-management/settings/by-current-user'
return ApiService.Put<any>(_url, payload, IdentityService)
}
/**
*
*/
public static getUserSettings(userId: string) {
const _url = '/api/setting-management/settings/by-user/' + userId
return ApiService.Get<ListResultDto<Setting>>(_url, IdentityService)
}
/**
*
*/
public static setUserSettings(userId: string, payload: SettingsUpdate) {
const _url = '/api/setting-management/settings/by-user/' + userId
return ApiService.Put<any>(_url, payload, IdentityService)
}
/** /**
* *
* @param providerName * @param providerName
@ -90,22 +58,22 @@ export class SettingBase {
value!: any value!: any
} }
/** 设置对象 */ // /** 设置对象 */
export class Setting extends SettingBase { // export class Setting extends SettingBase {
/** 显示名称 */ // /** 显示名称 */
displayName!: string // displayName!: string
/** 说明 */ // /** 说明 */
description!: string // description!: string
/** 默认设置 */ // /** 默认设置 */
defaultValue!: string // defaultValue!: string
public getValue() { // public getValue() {
if (this.value) { // if (this.value) {
return this.value // return this.value
} // }
return this.defaultValue // return this.defaultValue
} // }
} // }
/** 配置变更对象 */ /** 配置变更对象 */
export class SettingUpdate extends SettingBase {} export class SettingUpdate extends SettingBase {}
@ -119,3 +87,41 @@ export class SettingsUpdate {
this.settings = new Array<SettingUpdate>() this.settings = new Array<SettingUpdate>()
} }
} }
export enum ValueType {
String = 0,
Number = 1,
Boolean = 2,
Date = 3,
Array = 4,
Option = 5,
Object = 10
}
export class Option {
name!: string
value!: string
}
export class SettingDetail {
name!: string
displayName!: string
description?: string
value?: string
defaultValue!: string
valueType!: ValueType
isEncrypted = false
options = new Array<Option>()
}
export class Setting {
displayName!: string
description?: string
details = new Array<SettingDetail>()
}
export class SettingGroup {
displayName!: string
description?: string
settings = new Array<Setting>()
}

14
vueJs/src/views/admin/settings/components/GlobalSettingEditForm.vue

@ -1,6 +1,6 @@
<template> <template>
<SettingEditForm <SettingEditForm
:settings="settings" :setting-groups="settingGroups"
@onSettingSaving="onSettingSaving" @onSettingSaving="onSettingSaving"
/> />
</template> </template>
@ -8,7 +8,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator' import { Component, Vue } from 'vue-property-decorator'
import SettingEditForm from './SettingEditForm.vue' import SettingEditForm from './SettingEditForm.vue'
import SettingService, { Setting, SettingsUpdate } from '@/api/settings' import SettingService, { SettingGroup, SettingsUpdate } from '@/api/settings'
@Component({ @Component({
name: 'GlobalSettingEditForm', name: 'GlobalSettingEditForm',
@ -17,12 +17,14 @@ import SettingService, { Setting, SettingsUpdate } from '@/api/settings'
} }
}) })
export default class extends Vue { export default class extends Vue {
private settings = new Array<Setting>() private settingGroups = new Array<SettingGroup>()
mounted() { mounted() {
SettingService.getGlobalSettings().then(res => { SettingService
this.settings = res.items .getGlobalSettings()
}) .then(res => {
this.settingGroups = res.items
})
} }
private onSettingSaving(settings: SettingsUpdate) { private onSettingSaving(settings: SettingsUpdate) {

826
vueJs/src/views/admin/settings/components/SettingEditForm.vue

@ -2,698 +2,89 @@
<div> <div>
<el-form <el-form
ref="formsetting" ref="formsetting"
v-model="setting"
label-width="180px" label-width="180px"
style="width: 96%" style="width: 96%"
> >
<el-tabs :tab-position="tabPosition"> <el-tabs :tab-position="tabPosition">
<el-tab-pane <el-tab-pane
v-if="hasSettingExistsed('Abp.Localization.DefaultLanguage')" v-for="group in settingGroups"
:label="$t('settings.systemSetting')" :key="group.displayName"
:label="group.displayName"
> >
<el-form-item <el-card
v-if="hasSettingExistsed('Abp.Localization.DefaultLanguage')" v-for="setting in group.settings"
v-popover:DefaultLanguage :key="setting.displayName"
prop="setting['Abp.Localization.DefaultLanguage'].value"
> >
<el-popover <div
ref="DefaultLanguage" slot="header"
trigger="hover" class="clearfix"
:title="setting['Abp.Localization.DefaultLanguage'].displayName"
:content="setting['Abp.Localization.DefaultLanguage'].description"
/>
<span
slot="label"
v-popover:DefaultLanguage
>{{ setting['Abp.Localization.DefaultLanguage'].displayName }}</span>
<el-select
v-model="setting['Abp.Localization.DefaultLanguage'].value"
style="width: 100%;"
@change="(value) => handleSettingValueChanged('Abp.Localization.DefaultLanguage', value)"
> >
<el-option <span>{{ setting.displayName }}</span>
v-for="language in definedLanguages" </div>
:key="language" <el-form-item
:label="language" v-for="detail in setting.details"
:value="language" :key="detail.name"
:disabled="language===setting['Abp.Localization.DefaultLanguage'].value" :label="detail.displayName"
label-width="200px"
>
<el-popover
:ref="detail.name"
trigger="hover"
:title="detail.displayName"
:content="detail.description"
/> />
</el-select> <span
</el-form-item> slot="label"
<el-form-item v-popover="detail.name"
v-if="hasSettingExistsed('Abp.Timing.TimeZone')" >{{ detail.displayName }}</span>
prop="Abp.Timing.TimeZone'].value" <el-input
> v-if="detail.valueType===0"
<el-popover v-model="detail.value"
ref="TimeZone" :placeholder="detail.description"
trigger="hover" :type="detail.isEncrypted ? 'password' : 'text'"
:title="setting['Abp.Timing.TimeZone'].displayName" :show-password="detail.isEncrypted"
:content="setting['Abp.Timing.TimeZone'].description" @input="(value) => handleSettingValueChanged(detail.name, value)"
/> />
<span <el-input
slot="label" v-if="detail.valueType===1"
v-popover:TimeZone v-model="detail.value"
>{{ setting['Abp.Timing.TimeZone'].displayName }}</span> :placeholder="detail.description"
<el-input type="number"
v-model="setting['Abp.Timing.TimeZone'].value" @input="(value) => handleSettingValueChanged(detail.name, value)"
:placeholder="setting['Abp.Timing.TimeZone'].description" />
@input="(value) => handleSettingValueChanged('Abp.Timing.TimeZone', value)" <el-switch
/> v-if="detail.valueType===2"
</el-form-item> :value="detail.value==='true'"
</el-tab-pane> @change="(value) => {
<el-tab-pane handleSettingValueChanged(detail.name, value)
v-if="hasSettingExistsed('Abp.Identity.Password.RequiredLength')" detail.value = value.toString()
:label="$t('settings.passwordSecurity')" }"
> />
<el-form-item <el-select
v-if="hasSettingExistsed('Abp.Identity.Password.RequiredLength')" v-if="detail.valueType===5"
> v-model="detail.value"
<el-popover style="width: 100%;"
ref="PasswordRequiredLength" @change="(value) => handleSettingValueChanged(detail.name, value)"
trigger="hover" >
:title="setting['Abp.Identity.Password.RequiredLength'].displayName" <el-option
:content="setting['Abp.Identity.Password.RequiredLength'].description" v-for="option in detail.options"
/> :key="option.name"
<span :label="option.name"
slot="label" :value="option.value"
v-popover:PasswordRequiredLength :disabled="option.value===detail.value"
>{{ setting['Abp.Identity.Password.RequiredLength'].displayName }}</span> />
<el-input </el-select>
v-model="setting['Abp.Identity.Password.RequiredLength'].value" </el-form-item>
:placeholder="setting['Abp.Identity.Password.RequiredLength'].description" </el-card>
type="number"
@input="(value) => handleSettingValueChanged('Abp.Identity.Password.RequiredLength', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Password.RequiredUniqueChars')"
>
<el-popover
ref="PasswordRequiredUniqueChars"
trigger="hover"
:title="setting['Abp.Identity.Password.RequiredUniqueChars'].displayName"
:content="setting['Abp.Identity.Password.RequiredUniqueChars'].description"
/>
<span
slot="label"
v-popover:PasswordRequiredUniqueChars
>{{ setting['Abp.Identity.Password.RequiredUniqueChars'].displayName }}</span>
<el-input
v-model="setting['Abp.Identity.Password.RequiredUniqueChars'].value"
type="number"
@input="(value) => handleSettingValueChanged('Abp.Identity.Password.RequiredUniqueChars', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Password.RequireNonAlphanumeric')"
>
<el-popover
ref="PasswordRequireNonAlphanumeric"
trigger="hover"
:title="setting['Abp.Identity.Password.RequireNonAlphanumeric'].displayName"
:content="setting['Abp.Identity.Password.RequireNonAlphanumeric'].description"
/>
<span
slot="label"
v-popover:PasswordRequireNonAlphanumeric
>{{ setting['Abp.Identity.Password.RequireNonAlphanumeric'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.Password.RequireNonAlphanumeric'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.Password.RequireNonAlphanumeric', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Password.RequireLowercase')"
>
<el-popover
ref="PasswordRequireLowercase"
trigger="hover"
:title="setting['Abp.Identity.Password.RequireLowercase'].displayName"
:content="setting['Abp.Identity.Password.RequireLowercase'].description"
/>
<span
slot="label"
v-popover:PasswordRequireLowercase
>{{ setting['Abp.Identity.Password.RequireLowercase'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.Password.RequireLowercase'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.Password.RequireLowercase', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Password.RequireUppercase')"
>
<el-popover
ref="PasswordRequireUppercase"
trigger="hover"
:title="setting['Abp.Identity.Password.RequireUppercase'].displayName"
:content="setting['Abp.Identity.Password.RequireUppercase'].description"
/>
<span
slot="label"
v-popover:PasswordRequireUppercase
>{{ setting['Abp.Identity.Password.RequireUppercase'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.Password.RequireUppercase'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.Password.RequireUppercase', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Password.RequireDigit')"
>
<el-popover
ref="PasswordRequireDigit"
trigger="hover"
:title="setting['Abp.Identity.Password.RequireDigit'].displayName"
:content="setting['Abp.Identity.Password.RequireDigit'].description"
/>
<span
slot="label"
v-popover:PasswordRequireDigit
>{{ setting['Abp.Identity.Password.RequireDigit'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.Password.RequireDigit'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.Password.RequireDigit', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Lockout.AllowedForNewUsers')"
>
<el-popover
ref="LockoutAllowedForNewUsers"
trigger="hover"
:title="setting['Abp.Identity.Lockout.AllowedForNewUsers'].displayName"
:content="setting['Abp.Identity.Lockout.AllowedForNewUsers'].description"
/>
<span
slot="label"
v-popover:LockoutAllowedForNewUsers
>{{ setting['Abp.Identity.Lockout.AllowedForNewUsers'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.Lockout.AllowedForNewUsers'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.Lockout.AllowedForNewUsers', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Lockout.LockoutDuration')"
>
<el-popover
ref="LockoutLockoutDuration"
trigger="hover"
:title="setting['Abp.Identity.Lockout.LockoutDuration'].displayName"
:content="setting['Abp.Identity.Lockout.LockoutDuration'].description"
/>
<span
slot="label"
v-popover:LockoutLockoutDuration
>{{ setting['Abp.Identity.Lockout.LockoutDuration'].displayName }}</span>
<el-input
v-model="setting['Abp.Identity.Lockout.LockoutDuration'].value"
:placeholder="setting['Abp.Identity.Lockout.LockoutDuration'].description"
type="number"
@input="(value) => handleSettingValueChanged('Abp.Identity.Lockout.LockoutDuration', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.Lockout.MaxFailedAccessAttempts')"
>
<el-popover
ref="LockoutMaxFailedAccessAttempts"
trigger="hover"
:title="setting['Abp.Identity.Lockout.MaxFailedAccessAttempts'].displayName"
:content="setting['Abp.Identity.Lockout.MaxFailedAccessAttempts'].description"
/>
<span
slot="label"
v-popover:LockoutMaxFailedAccessAttempts
>{{ setting['Abp.Identity.Lockout.MaxFailedAccessAttempts'].displayName }}</span>
<el-input
v-model="setting['Abp.Identity.Lockout.MaxFailedAccessAttempts'].value"
:placeholder="setting['Abp.Identity.Lockout.MaxFailedAccessAttempts'].description"
type="number"
@input="(value) => handleSettingValueChanged('Abp.Identity.Lockout.MaxFailedAccessAttempts', value)"
/>
</el-form-item>
</el-tab-pane>
<el-tab-pane
v-if="hasSettingExistsed('Abp.Identity.SignIn.RequireConfirmedEmail')"
:label="$t('settings.userAccount')"
>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.SignIn.RequireConfirmedEmail')"
>
<el-popover
ref="SignInRequireConfirmedEmail"
trigger="hover"
:title="setting['Abp.Identity.SignIn.RequireConfirmedEmail'].displayName"
:content="setting['Abp.Identity.SignIn.RequireConfirmedEmail'].description"
/>
<span
slot="label"
v-popover:SignInRequireConfirmedEmail
>{{ setting['Abp.Identity.SignIn.RequireConfirmedEmail'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.SignIn.RequireConfirmedEmail'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.SignIn.RequireConfirmedEmail', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.SignIn.EnablePhoneNumberConfirmation')"
>
<el-popover
ref="SignInEnablePhoneNumberConfirmation"
trigger="hover"
:title="setting['Abp.Identity.SignIn.EnablePhoneNumberConfirmation'].displayName"
:content="setting['Abp.Identity.SignIn.EnablePhoneNumberConfirmation'].description"
/>
<span
slot="label"
v-popover:SignInEnablePhoneNumberConfirmation
>{{ setting['Abp.Identity.SignIn.EnablePhoneNumberConfirmation'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.SignIn.EnablePhoneNumberConfirmation'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.SignIn.EnablePhoneNumberConfirmation', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.SignIn.RequireConfirmedPhoneNumber')"
>
<el-popover
ref="SignInRequireConfirmedPhoneNumber"
trigger="hover"
:title="setting['Abp.Identity.SignIn.RequireConfirmedPhoneNumber'].displayName"
:content="setting['Abp.Identity.SignIn.RequireConfirmedPhoneNumber'].description"
/>
<span
slot="label"
v-popover:SignInRequireConfirmedPhoneNumber
>{{ setting['Abp.Identity.SignIn.RequireConfirmedPhoneNumber'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.SignIn.RequireConfirmedPhoneNumber'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.SignIn.RequireConfirmedPhoneNumber', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.User.IsUserNameUpdateEnabled')"
>
<el-popover
ref="UserIsUserNameUpdateEnabled"
trigger="hover"
:title="setting['Abp.Identity.User.IsUserNameUpdateEnabled'].displayName"
:content="setting['Abp.Identity.User.IsUserNameUpdateEnabled'].description"
/>
<span
slot="label"
v-popover:UserIsUserNameUpdateEnabled
>{{ setting['Abp.Identity.User.IsUserNameUpdateEnabled'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.User.IsUserNameUpdateEnabled'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.User.IsUserNameUpdateEnabled', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.User.IsEmailUpdateEnabled')"
>
<el-popover
ref="UserIsEmailUpdateEnabled"
trigger="hover"
:title="setting['Abp.Identity.User.IsEmailUpdateEnabled'].displayName"
:content="setting['Abp.Identity.User.IsEmailUpdateEnabled'].description"
/>
<span
slot="label"
v-popover:UserIsEmailUpdateEnabled
>{{ setting['Abp.Identity.User.IsEmailUpdateEnabled'].displayName }}</span>
<el-switch
v-model="setting['Abp.Identity.User.IsEmailUpdateEnabled'].value"
@input="(value) => handleSettingValueChanged('Abp.Identity.User.IsEmailUpdateEnabled', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Identity.OrganizationUnit.MaxUserMembershipCount')"
>
<el-popover
ref="OrganizationUnitMaxUserMembershipCount"
trigger="hover"
:title="setting['Abp.Identity.OrganizationUnit.MaxUserMembershipCount'].displayName"
:content="setting['Abp.Identity.OrganizationUnit.MaxUserMembershipCount'].description"
/>
<span
slot="label"
v-popover:OrganizationUnitMaxUserMembershipCount
>{{ setting['Abp.Identity.OrganizationUnit.MaxUserMembershipCount'].displayName }}</span>
<el-input
v-model="setting['Abp.Identity.OrganizationUnit.MaxUserMembershipCount'].value"
:placeholder="setting['Abp.Identity.OrganizationUnit.MaxUserMembershipCount'].description"
type="number"
@input="(value) => handleSettingValueChanged('Abp.Identity.OrganizationUnit.MaxUserMembershipCount', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Account.SmsRegisterTemplateCode')"
>
<el-popover
ref="AccountSmsRegisterTemplateCode"
trigger="hover"
:title="setting['Abp.Account.SmsRegisterTemplateCode'].displayName"
:content="setting['Abp.Account.SmsRegisterTemplateCode'].description"
/>
<span
slot="label"
v-popover:AccountSmsRegisterTemplateCode
>{{ setting['Abp.Account.SmsRegisterTemplateCode'].displayName }}</span>
<el-input
v-model="setting['Abp.Account.SmsRegisterTemplateCode'].value"
:placeholder="setting['Abp.Account.SmsRegisterTemplateCode'].description"
@input="(value) => handleSettingValueChanged('Abp.Account.SmsRegisterTemplateCode', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Account.SmsSigninTemplateCode')"
>
<el-popover
ref="AccountSmsSigninTemplateCode"
trigger="hover"
:title="setting['Abp.Account.SmsSigninTemplateCode'].displayName"
:content="setting['Abp.Account.SmsSigninTemplateCode'].description"
/>
<span
slot="label"
v-popover:AccountSmsSigninTemplateCode
>{{ setting['Abp.Account.SmsSigninTemplateCode'].displayName }}</span>
<el-input
v-model="setting['Abp.Account.SmsSigninTemplateCode'].value"
:placeholder="setting['Abp.Account.SmsSigninTemplateCode'].description"
@input="(value) => handleSettingValueChanged('Abp.Account.SmsSigninTemplateCode', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Account.SmsResetPasswordTemplateCode')"
>
<el-popover
ref="AccountSmsResetPasswordTemplateCode"
trigger="hover"
:title="setting['Abp.Account.SmsResetPasswordTemplateCode'].displayName"
:content="setting['Abp.Account.SmsResetPasswordTemplateCode'].description"
/>
<span
slot="label"
v-popover:AccountSmsResetPasswordTemplateCode
>{{ setting['Abp.Account.SmsResetPasswordTemplateCode'].displayName }}</span>
<el-input
v-model="setting['Abp.Account.SmsResetPasswordTemplateCode'].value"
:placeholder="setting['Abp.Account.SmsResetPasswordTemplateCode'].description"
@input="(value) => handleSettingValueChanged('Abp.Account.SmsResetPasswordTemplateCode', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Account.PhoneVerifyCodeExpiration')"
>
<el-popover
ref="AccountPhoneVerifyCodeExpiration"
trigger="hover"
:title="setting['Abp.Account.PhoneVerifyCodeExpiration'].displayName"
:content="setting['Abp.Account.PhoneVerifyCodeExpiration'].description"
/>
<span
slot="label"
v-popover:AccountPhoneVerifyCodeExpiration
>{{ setting['Abp.Account.PhoneVerifyCodeExpiration'].displayName }}</span>
<el-input
v-model="setting['Abp.Account.PhoneVerifyCodeExpiration'].value"
:placeholder="setting['Abp.Account.PhoneVerifyCodeExpiration'].description"
type="number"
@input="(value) => handleSettingValueChanged('Abp.Account.PhoneVerifyCodeExpiration', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Account.IsSelfRegistrationEnabled')"
>
<el-popover
ref="AccountIsSelfRegistrationEnabled"
trigger="hover"
:title="setting['Abp.Account.IsSelfRegistrationEnabled'].displayName"
:content="setting['Abp.Account.IsSelfRegistrationEnabled'].description"
/>
<span
slot="label"
v-popover:AccountIsSelfRegistrationEnabled
>{{ setting['Abp.Account.IsSelfRegistrationEnabled'].displayName }}</span>
<el-switch
v-model="setting['Abp.Account.IsSelfRegistrationEnabled'].value"
@input="(value) => handleSettingValueChanged('Abp.Account.IsSelfRegistrationEnabled', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Account.EnableLocalLogin')"
>
<el-popover
ref="AccountEnableLocalLogin"
trigger="hover"
:title="setting['Abp.Account.EnableLocalLogin'].displayName"
:content="setting['Abp.Account.EnableLocalLogin'].description"
/>
<span
slot="label"
v-popover:AccountEnableLocalLogin
>{{ setting['Abp.Account.EnableLocalLogin'].displayName }}</span>
<el-switch
v-model="setting['Abp.Account.EnableLocalLogin'].value"
@input="(value) => handleSettingValueChanged('Abp.Account.EnableLocalLogin', value)"
/>
</el-form-item>
</el-tab-pane>
<el-tab-pane
v-if="hasSettingExistsed('Abp.Mailing.Smtp.Host')"
:label="$t('settings.mailing')"
>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.Smtp.Host')"
>
<el-popover
ref="SmtpHost"
trigger="hover"
:title="setting['Abp.Mailing.Smtp.Host'].displayName"
:content="setting['Abp.Mailing.Smtp.Host'].description"
/>
<span
slot="label"
v-popover:SmtpHost
>{{ setting['Abp.Mailing.Smtp.Host'].displayName }}</span>
<el-input
v-model="setting['Abp.Mailing.Smtp.Host'].value"
:placeholder="setting['Abp.Mailing.Smtp.Host'].description"
@input="(value) => handleSettingValueChanged('Abp.Mailing.Smtp.Host', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.Smtp.Port')"
>
<el-popover
ref="SmtpPort"
trigger="hover"
:title="setting['Abp.Mailing.Smtp.Port'].displayName"
:content="setting['Abp.Mailing.Smtp.Port'].description"
/>
<span
slot="label"
v-popover:SmtpPort
>{{ setting['Abp.Mailing.Smtp.Port'].displayName }}</span>
<el-input
v-model="setting['Abp.Mailing.Smtp.Port'].value"
:placeholder="setting['Abp.Mailing.Smtp.Port'].description"
type="number"
@input="(value) => handleSettingValueChanged('Abp.Mailing.Smtp.Port', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.Smtp.UserName')"
>
<el-popover
ref="SmtpUserName"
trigger="hover"
:title="setting['Abp.Mailing.Smtp.UserName'].displayName"
:content="setting['Abp.Mailing.Smtp.UserName'].description"
/>
<span
slot="label"
v-popover:SmtpUserName
>{{ setting['Abp.Mailing.Smtp.UserName'].displayName }}</span>
<el-input
v-model="setting['Abp.Mailing.Smtp.UserName'].value"
:placeholder="setting['Abp.Mailing.Smtp.UserName'].description"
@input="(value) => handleSettingValueChanged('Abp.Mailing.Smtp.UserName', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.Smtp.Password')"
>
<el-popover
ref="SmtpPassword"
trigger="hover"
:title="setting['Abp.Mailing.Smtp.Password'].displayName"
:content="setting['Abp.Mailing.Smtp.Password'].description"
/>
<span
slot="label"
v-popover:SmtpPassword
>{{ setting['Abp.Mailing.Smtp.Password'].displayName }}</span>
<el-input
v-model="setting['Abp.Mailing.Smtp.Password'].value"
:placeholder="setting['Abp.Mailing.Smtp.Password'].description"
type="password"
@input="(value) => handleSettingValueChanged('Abp.Mailing.Smtp.Password', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.Smtp.Domain')"
>
<el-popover
ref="SmtpDomain"
trigger="hover"
:title="setting['Abp.Mailing.Smtp.Domain'].displayName"
:content="setting['Abp.Mailing.Smtp.Domain'].description"
/>
<span
slot="label"
v-popover:SmtpDomain
>{{ setting['Abp.Mailing.Smtp.Domain'].displayName }}</span>
<el-input
v-model="setting['Abp.Mailing.Smtp.Domain'].value"
:placeholder="setting['Abp.Mailing.Smtp.Domain'].description"
@input="(value) => handleSettingValueChanged('Abp.Mailing.Smtp.Domain', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.Smtp.EnableSsl')"
>
<el-popover
ref="SmtpEnableSsl"
trigger="hover"
:title="setting['Abp.Mailing.Smtp.EnableSsl'].displayName"
:content="setting['Abp.Mailing.Smtp.EnableSsl'].description"
/>
<span
slot="label"
v-popover:SmtpEnableSsl
>{{ setting['Abp.Mailing.Smtp.EnableSsl'].displayName }}</span>
<el-switch
v-model="setting['Abp.Mailing.Smtp.EnableSsl'].value"
@input="(value) => handleSettingValueChanged('Abp.Mailing.Smtp.EnableSsl', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.Smtp.UseDefaultCredentials')"
>
<el-popover
ref="SmtpUseDefaultCredentials"
trigger="hover"
:title="setting['Abp.Mailing.Smtp.UseDefaultCredentials'].displayName"
:content="setting['Abp.Mailing.Smtp.UseDefaultCredentials'].description"
/>
<span
slot="label"
v-popover:SmtpUseDefaultCredentials
>{{ setting['Abp.Mailing.Smtp.UseDefaultCredentials'].displayName }}</span>
<el-switch
v-model="setting['Abp.Mailing.Smtp.UseDefaultCredentials'].value"
@input="(value) => handleSettingValueChanged('Abp.Mailing.Smtp.UseDefaultCredentials', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.DefaultFromAddress')"
>
<el-popover
ref="MailingDefaultFromAddress"
trigger="hover"
:title="setting['Abp.Mailing.DefaultFromAddress'].displayName"
:content="setting['Abp.Mailing.DefaultFromAddress'].description"
/>
<span
slot="label"
v-popover:MailingDefaultFromAddress
>{{ setting['Abp.Mailing.DefaultFromAddress'].displayName }}</span>
<el-input
v-model="setting['Abp.Mailing.DefaultFromAddress'].value"
:placeholder="setting['Abp.Mailing.DefaultFromAddress'].description"
@input="(value) => handleSettingValueChanged('Abp.Mailing.DefaultFromAddress', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.Mailing.DefaultFromDisplayName')"
>
<el-popover
ref="MailingDefaultFromDisplayName"
trigger="hover"
:title="setting['Abp.Mailing.DefaultFromDisplayName'].displayName"
:content="setting['Abp.Mailing.DefaultFromDisplayName'].description"
/>
<span
slot="label"
v-popover:MailingDefaultFromDisplayName
>{{ setting['Abp.Mailing.DefaultFromDisplayName'].displayName }}</span>
<el-input
v-model="setting['Abp.Mailing.DefaultFromDisplayName'].value"
:placeholder="setting['Abp.Mailing.DefaultFromDisplayName'].description"
@input="(value) => handleSettingValueChanged('Abp.Mailing.DefaultFromDisplayName', value)"
/>
</el-form-item>
</el-tab-pane>
<el-tab-pane
v-if="hasSettingExistsed('Abp.FileManagement.FileLimitLength')"
:label="$t('fileSystem.setting')"
>
<el-form-item
v-if="hasSettingExistsed('Abp.FileManagement.FileLimitLength')"
prop="Abp.FileManagement.FileLimitLength'].value"
>
<el-popover
ref="FileLimitLength"
trigger="hover"
:title="setting['Abp.FileManagement.FileLimitLength'].displayName"
:content="setting['Abp.FileManagement.FileLimitLength'].description"
/>
<span
slot="label"
v-popover:FileLimitLength
>{{ setting['Abp.FileManagement.FileLimitLength'].displayName }}</span>
<el-input
v-model="setting['Abp.FileManagement.FileLimitLength'].value"
:placeholder="setting['Abp.FileManagement.FileLimitLength'].description"
type="number"
@input="(value) => handleSettingValueChanged('Abp.FileManagement.FileLimitLength', value)"
/>
</el-form-item>
<el-form-item
v-if="hasSettingExistsed('Abp.FileManagement.AllowFileExtensions')"
prop="Abp.FileManagement.AllowFileExtensions'].value"
>
<el-popover
ref="AllowFileExtensions"
trigger="hover"
:title="setting['Abp.FileManagement.AllowFileExtensions'].displayName"
:content="setting['Abp.FileManagement.AllowFileExtensions'].description"
/>
<span
slot="label"
v-popover:AllowFileExtensions
>{{ setting['Abp.FileManagement.AllowFileExtensions'].displayName }}</span>
<el-input
v-model="setting['Abp.FileManagement.AllowFileExtensions'].value"
:placeholder="setting['Abp.FileManagement.AllowFileExtensions'].description"
@input="(value) => handleSettingValueChanged('Abp.FileManagement.AllowFileExtensions', value)"
/>
</el-form-item>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<el-form-item <el-form-item
v-if="settings.length>0" v-if="changeSetting.settings.length>0"
> >
<el-button <el-button
type="primary" type="primary"
style="width:200px;margin:inherit;" class="save-button"
@click="onSavesetting" @click="onSavesetting"
> >
{{ $t('global.confirm') }} {{ $t('global.confirm') }}
@ -704,82 +95,45 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Watch, Vue } from 'vue-property-decorator' import { Component, Prop, Vue } from 'vue-property-decorator'
import { AbpModule } from '@/store/modules/abp' import { SettingGroup, SettingUpdate, SettingsUpdate } from '@/api/settings'
import { Setting, SettingUpdate, SettingsUpdate } from '@/api/settings' import { isUndefined } from 'lodash'
const booleanStrings = ['True', 'true', 'False', 'false']
@Component({ @Component({
name: 'SettingEditForm' name: 'SettingEditForm'
}) })
export default class extends Vue { export default class extends Vue {
@Prop({ default: () => { return Array<Setting>() } }) @Prop({ default: () => { return Array<SettingGroup>() } })
private settings!: Setting[] private settingGroups!: SettingGroup[]
@Prop({ default: 'top' }) @Prop({ default: 'top' })
private tabPosition!: 'left' | 'right' | 'top' | 'bottom' private tabPosition!: 'left' | 'right' | 'top' | 'bottom'
private setting: {[key: string]: Setting} = {} private changeSetting = new SettingsUpdate()
private settingChangeKeys = new Array<string>()
get definedLanguages() {
const languages = AbpModule.configuration.localization.languages.map((lang: any) => {
return lang.cultureName
})
return languages
}
@Watch('settings', { immediate: true })
private onSettingChanged() {
if (this.settings.length > 0) {
this.settings.forEach(setting => {
if (setting.value) {
const value = setting.value.toLowerCase()
if (booleanStrings.includes(value)) {
setting.value = (value === 'true')
}
} else {
if (setting.defaultValue) {
const defaultValue = setting.defaultValue.toLowerCase()
if (booleanStrings.includes(defaultValue)) {
setting.value = (defaultValue === 'true')
}
}
}
this.setting[setting.name] = setting
})
this.$forceUpdate()
}
}
private hasSettingExistsed(key: string) {
if (this.setting[key]) {
return true
}
return false
}
private handleSettingValueChanged(key: string, value: any) { private handleSettingValueChanged(key: string, value: any) {
if (!this.settingChangeKeys.includes(key)) { const setting = this.changeSetting.settings.find(setting => setting.name === key)
this.settingChangeKeys.push(key) if (isUndefined(setting)) {
const setting = new SettingUpdate()
setting.name = key
setting.value = value
this.changeSetting.settings.push(setting)
} else {
setting.value = value
} }
this.$set(this.setting[key], 'value', value)
this.$forceUpdate()
} }
private onSavesetting() { private onSavesetting() {
const updateSettings = new SettingsUpdate() if (this.changeSetting.settings.length > 0) {
this.settingChangeKeys.forEach(key => { this.$emit('onSettingSaving', this.changeSetting)
const updateSetting = new SettingUpdate()
updateSetting.name = key
updateSetting.value = this.setting[key].value
updateSettings.settings.push(updateSetting)
})
if (updateSettings.settings.length > 0) {
this.$emit('onSettingSaving', updateSettings)
} }
} }
} }
</script> </script>
<style scoped>
.save-button {
width: 200px;
margin-top: 30px;
}
</style>

14
vueJs/src/views/admin/settings/components/TenantSettingEditForm.vue

@ -1,6 +1,6 @@
<template> <template>
<SettingEditForm <SettingEditForm
:settings="settings" :setting-groups="settingGroups"
@onSettingSaving="onSettingSaving" @onSettingSaving="onSettingSaving"
/> />
</template> </template>
@ -8,7 +8,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator' import { Component, Vue } from 'vue-property-decorator'
import SettingEditForm from './SettingEditForm.vue' import SettingEditForm from './SettingEditForm.vue'
import SettingService, { Setting, SettingsUpdate } from '@/api/settings' import SettingService, { SettingGroup, SettingsUpdate } from '@/api/settings'
@Component({ @Component({
name: 'TenantSettingEditForm', name: 'TenantSettingEditForm',
@ -17,12 +17,14 @@ import SettingService, { Setting, SettingsUpdate } from '@/api/settings'
} }
}) })
export default class extends Vue { export default class extends Vue {
private settings = new Array<Setting>() private settingGroups = new Array<SettingGroup>()
mounted() { mounted() {
SettingService.getCurrentTenantSettings().then(res => { SettingService
this.settings = res.items .getCurrentTenantSettings()
}) .then(res => {
this.settingGroups = res.items
})
} }
private onSettingSaving(settings: SettingsUpdate) { private onSettingSaving(settings: SettingsUpdate) {

Loading…
Cancel
Save