From 3d75cdcf4ba8cfaf23950dc6fcc7e99a6009c7cb Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 17 Jun 2026 14:45:55 +0800 Subject: [PATCH] feat(settings): Enhancement settings definition --- .../AliyunSettingAppService.cs | 2 +- .../LINGYUN.Abp.Aliyun.csproj | 1 + .../Aliyun/Settings/AliyunSettingProvider.cs | 134 ++++++-- .../Abp/Tencent/QQ/Localization/en.json | 3 +- .../Abp/Tencent/QQ/Localization/zh-Hans.json | 3 +- .../TencentQQSettingDefinitionProvider.cs | 18 +- .../TencentCloudSettingAppService.cs | 2 +- .../LINGYUN.Abp.Tencent.csproj | 4 + .../Tencent/Localization/Resources/en.json | 6 +- .../Localization/Resources/zh-Hans.json | 6 +- .../TencentCloudSettingDefinitionProvider.cs | 68 +++- .../Settings/TencentCloudSettingNames.cs | 39 +++ ...ingManagement.Application.Contracts.csproj | 4 + .../Dto/SettingDetailsDto.cs | 1 + .../Abp/SettingManagement/Dto/SettingDto.cs | 1 + .../IReadonlySettingV2AppService.cs | 9 + .../SettingManagement/ISettingV2AppService.cs | 8 + .../IUserSettingV2AppService.cs | 11 + .../LINGYUN.Abp.Settings.csproj | 1 + .../Settings/ISettingProviderExtensions.cs | 2 +- .../Settings/SettingDefinitionExtensions.cs | 314 ++++++++++++++++++ .../Abp/Settings/SettingResourceDefinition.cs | 119 +++++++ .../Volo/Abp/Settings}/ValueType.cs | 2 +- .../Localization/Resources/en.json | 3 +- .../Localization/Resources/zh-Hans.json | 3 +- ...hatMiniProgramSettingDefinitionProvider.cs | 34 +- .../Official/Localization/Resources/en.json | 3 +- .../Localization/Resources/zh-Hans.json | 3 +- ...WeChatOfficialSettingDefinitionProvider.cs | 51 ++- .../Contacts/Localization/Resources/en.json | 3 +- .../Localization/Resources/zh-Hans.json | 3 +- ...hatWorkContactSettingDefinitionProvider.cs | 16 +- .../Localization/Resources/en.json | 3 +- .../Localization/Resources/zh-Hans.json | 3 +- ...xternalContactSettingDefinitionProvider.cs | 16 +- .../LINGYUN.Abp.WeChat.Work.csproj | 1 + .../Work/Localization/Resources/en.json | 5 +- .../Work/Localization/Resources/zh-Hans.json | 5 +- .../WeChatWorkSettingDefinitionProvider.cs | 53 ++- .../LINGYUN.Abp.WeChat.csproj | 1 + .../Abp/WeChat/Localization/Resources/en.json | 4 +- .../Localization/Resources/zh-Hans.json | 4 +- .../WeChatSettingDefinitionProvider.cs | 8 +- .../AccountGroupSettingDefinitionProvider.cs | 31 ++ .../LINGYUN.Abp.Account.OAuth.csproj | 4 + .../AccountOAuthSettingDefinitionProvider.cs | 27 +- .../Localization/Resources/en.json | 4 +- .../Localization/Resources/zh-Hans.json | 4 +- .../LINGYUN.Abp.AIManagement.Domain.csproj | 1 + .../AIManagementSettingDefinitionProvider.cs | 14 +- ...mentPermissionSettingDefinitionProvider.cs | 18 + ...UN.Abp.BlobManagement.Domain.Shared.csproj | 4 + .../Localization/Resources/en.json | 4 +- .../Localization/Resources/zh-Hans.json | 4 +- ...BlobManagementSettingDefinitionProvider.cs | 29 +- .../BlobManagementSettingAppService.cs | 2 +- .../LINGYUN.Abp.Identity.Domain.Shared.csproj | 4 + .../LINGYUN/Abp/Identity/Localization/en.json | 10 +- .../Abp/Identity/Localization/zh-Hans.json | 10 +- .../IdentitySettingDefinitionProvider.cs | 67 +++- .../LINGYUN.Abp.Identity.Domain.csproj | 1 + .../IdentityGroupSettingDefinitionProvider.cs | 247 ++++++++++++++ ...UN.Abp.MessageService.Domain.Shared.csproj | 1 + .../Localization/Resources/en.json | 6 +- .../Localization/Resources/zh-Hans.json | 6 +- ...MessageServiceSettingDefinitionProvider.cs | 6 +- .../WebhookNotificationPublishProvider.cs | 23 +- ...N.Abp.SettingManagement.Application.csproj | 1 + .../AbpSettingManagementApplicationModule.cs | 5 + .../Localization/Resources/en.json | 10 +- .../Localization/Resources/zh-Hans.json | 10 +- .../SettingManagement/SettingV2AppService.cs | 62 ++++ .../SettingV2AppServiceBase.cs | 165 +++++++++ .../UserSettingV2AppService.cs | 38 +++ .../SettingManagement/SettingController.cs | 106 +++--- .../SettingManagement/SettingV2Controller.cs | 26 ++ .../UserSettingV2Controller.cs | 26 ++ 77 files changed, 1782 insertions(+), 174 deletions(-) create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IReadonlySettingV2AppService.cs create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/ISettingV2AppService.cs create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IUserSettingV2AppService.cs create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingDefinitionExtensions.cs create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingResourceDefinition.cs rename aspnet-core/framework/settings/{LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto => LINGYUN.Abp.Settings/Volo/Abp/Settings}/ValueType.cs (93%) create mode 100644 aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountGroupSettingDefinitionProvider.cs create mode 100644 aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/BlobManagementPermissionSettingDefinitionProvider.cs create mode 100644 aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityGroupSettingDefinitionProvider.cs create mode 100644 aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppService.cs create mode 100644 aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppServiceBase.cs create mode 100644 aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/UserSettingV2AppService.cs create mode 100644 aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingV2Controller.cs create mode 100644 aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/UserSettingV2Controller.cs diff --git a/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs b/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs index 08ddb96d7..12fadff37 100644 --- a/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs +++ b/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun.SettingManagement/LINGYUN/Abp/Aliyun/SettingManagement/AliyunSettingAppService.cs @@ -9,7 +9,7 @@ using Volo.Abp.Authorization.Permissions; using Volo.Abp.MultiTenancy; using Volo.Abp.SettingManagement; using Volo.Abp.Settings; -using ValueType = LINGYUN.Abp.SettingManagement.ValueType; +using ValueType = Volo.Abp.Settings.ValueType; namespace LINGYUN.Abp.Aliyun.SettingManagement; diff --git a/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN.Abp.Aliyun.csproj b/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN.Abp.Aliyun.csproj index fd6b3232a..317bed293 100644 --- a/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN.Abp.Aliyun.csproj +++ b/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN.Abp.Aliyun.csproj @@ -35,6 +35,7 @@ + diff --git a/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs b/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs index 955594a6a..ce6473eb9 100644 --- a/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs +++ b/aspnet-core/framework/cloud-aliyun/LINGYUN.Abp.Aliyun/LINGYUN/Abp/Aliyun/Settings/AliyunSettingProvider.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.Aliyun.Localization; +using LINGYUN.Abp.Aliyun.Features; +using LINGYUN.Abp.Aliyun.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +7,8 @@ namespace LINGYUN.Abp.Aliyun.Settings; public class AliyunSettingProvider : SettingDefinitionProvider { + private const string GroupName = "Aliyun"; + public override void Define(ISettingDefinitionContext context) { context.Add(GetAuthorizationSettings()); @@ -28,7 +31,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")), new SettingDefinition( AliyunSettingNames.Authorization.AccessKeySecret, displayName: L("DisplayName:AccessKeySecret"), @@ -40,7 +48,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")), new SettingDefinition( AliyunSettingNames.Authorization.DurationSeconds, defaultValue: "3600", @@ -52,7 +65,13 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")) + .WithValueType(ValueType.Number), new SettingDefinition( AliyunSettingNames.Authorization.Policy, displayName: L("DisplayName:Policy"), @@ -64,7 +83,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")), new SettingDefinition( AliyunSettingNames.Authorization.RamRoleArn, displayName: L("DisplayName:RamRoleArn"), @@ -76,7 +100,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")), new SettingDefinition( AliyunSettingNames.Authorization.RegionId, defaultValue: "cn-hangzhou", @@ -88,7 +117,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")), new SettingDefinition( AliyunSettingNames.Authorization.RoleSessionName, displayName: L("DisplayName:RoleSessionName"), @@ -100,7 +134,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")), new SettingDefinition( AliyunSettingNames.Authorization.UseSecurityTokenService, defaultValue: true.ToString(), @@ -112,7 +151,13 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Enable]) + .WithParent("RAM", L("DisplayName:Aliyun.RAM")) + .WithValueType(ValueType.Boolean), }; } @@ -131,7 +176,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("Sms", L("DisplayName:Aliyun.Sms")), new SettingDefinition( AliyunSettingNames.Sms.DefaultSignName, displayName: L("DisplayName:DefaultSignName"), @@ -143,7 +193,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("Sms", L("DisplayName:Aliyun.Sms")), new SettingDefinition( AliyunSettingNames.Sms.DefaultTemplateCode, displayName: L("DisplayName:DefaultTemplateCode"), @@ -155,7 +210,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("Sms", L("DisplayName:Aliyun.Sms")), new SettingDefinition( AliyunSettingNames.Sms.DefaultPhoneNumber, displayName: L("DisplayName:DefaultPhoneNumber"), @@ -166,7 +226,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("Sms", L("DisplayName:Aliyun.Sms")), new SettingDefinition( AliyunSettingNames.Sms.Domain, defaultValue: "dysmsapi.aliyuncs.com", @@ -178,7 +243,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("Sms", L("DisplayName:Aliyun.Sms")), new SettingDefinition( AliyunSettingNames.Sms.Version, defaultValue: "2017-05-25", @@ -190,7 +260,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("Sms", L("DisplayName:Aliyun.Sms")), new SettingDefinition( AliyunSettingNames.Sms.VisableErrorToClient, defaultValue: false.ToString(), @@ -203,6 +278,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("Sms", L("DisplayName:Aliyun.Sms")) + .WithValueType(ValueType.Boolean) }; } @@ -221,7 +302,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("SmsVerifyCode", L("DisplayName:Aliyun.SmsVerifyCode")), new SettingDefinition( AliyunSettingNames.SmsVerifyCode.DefaultSignName, displayName: L("DisplayName:DefaultSignName"), @@ -233,7 +319,12 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("SmsVerifyCode", L("DisplayName:Aliyun.SmsVerifyCode")), new SettingDefinition( AliyunSettingNames.SmsVerifyCode.DefaultTemplateCode, displayName: L("DisplayName:DefaultTemplateCode"), @@ -245,10 +336,15 @@ public class AliyunSettingProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("DisplayName:Aliyun"), + requiredFeatures: [AliyunFeatureNames.Sms.Enable]) + .WithParent("SmsVerifyCode", L("DisplayName:Aliyun.SmsVerifyCode")), }; } - private ILocalizableString L(string name) + private LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/en.json b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/en.json index d60c9bc60..db8f61c9b 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/en.json +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/en.json @@ -11,6 +11,7 @@ "DisplayName:QQConnect.AppKey": "AppKey", "Description:QQConnect.AppKey": "When accessing user resources, it is used to verify the validity of the application and apply for it in QQ Interconnection Management Center.", "DisplayName:QQConnect.IsMobile": "Whether to move the style", - "Description:QQConnect.IsMobile": "The style used for display is displayed as the style under PC by default." + "Description:QQConnect.IsMobile": "The style used for display is displayed as the style under PC by default.", + "Settings:TenantCloud.QQConnect": "QQ Connect" } } \ No newline at end of file diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/zh-Hans.json b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/zh-Hans.json index 6387384f3..00406dfc2 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/zh-Hans.json +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Localization/zh-Hans.json @@ -11,6 +11,7 @@ "DisplayName:QQConnect.AppKey": "AppId对应的密钥", "Description:QQConnect.AppKey": "访问用户资源时用来验证应用的合法性, 在QQ互联管理中心申请.", "DisplayName:QQConnect.IsMobile": "是否移动端样式", - "Description:QQConnect.IsMobile": "用于展示的样式, 默认展示为PC下的样式." + "Description:QQConnect.IsMobile": "用于展示的样式, 默认展示为PC下的样式.", + "Settings:TenantCloud.QQConnect": "QQ互联" } } \ No newline at end of file diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingDefinitionProvider.cs b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingDefinitionProvider.cs index e66c6d8b8..180896dae 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingDefinitionProvider.cs +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.QQ/LINGYUN/Abp/Tencent/QQ/Settings/TencentQQSettingDefinitionProvider.cs @@ -6,6 +6,8 @@ namespace LINGYUN.Abp.Tencent.QQ.Settings; public class TencentQQSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "TenantCloud"; + public override void Define(ISettingDefinitionContext context) { context.Add(GetQQConnectSettings()); @@ -25,7 +27,10 @@ public class TencentQQSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("QQConnect", L("Settings:TenantCloud.QQConnect"), order: 10) + .WithOrder(0), new SettingDefinition( TencentQQSettingNames.QQConnect.AppKey, displayName: L("DisplayName:QQConnect.AppKey"), @@ -36,7 +41,10 @@ public class TencentQQSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("QQConnect", L("Settings:TenantCloud.QQConnect"), order: 10) + .WithOrder(1), new SettingDefinition( TencentQQSettingNames.QQConnect.IsMobile, "false", @@ -49,10 +57,14 @@ public class TencentQQSettingDefinitionProvider : SettingDefinitionProvider ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("QQConnect", L("Settings:TenantCloud.QQConnect"), order: 10) + .WithOrder(2) + .WithValueType(ValueType.Boolean) }; } - protected ILocalizableString L(string name) + protected LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TencentCloudSettingAppService.cs b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TencentCloudSettingAppService.cs index 71cf1ee4d..2cb8616aa 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TencentCloudSettingAppService.cs +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent.SettingManagement/LINGYUN/Abp/Tencent/SettingManagement/TencentCloudSettingAppService.cs @@ -10,7 +10,7 @@ using Volo.Abp.Authorization.Permissions; using Volo.Abp.MultiTenancy; using Volo.Abp.SettingManagement; using Volo.Abp.Settings; -using ValueType = LINGYUN.Abp.SettingManagement.ValueType; +using ValueType = Volo.Abp.Settings.ValueType; namespace LINGYUN.Abp.Tencent.SettingManagement; diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN.Abp.Tencent.csproj b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN.Abp.Tencent.csproj index e03c07cfa..976c4de5f 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN.Abp.Tencent.csproj +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN.Abp.Tencent.csproj @@ -31,4 +31,8 @@ + + + + diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/en.json b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/en.json index 5f97f9c43..736a5cb07 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/en.json +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/en.json @@ -57,6 +57,10 @@ "Region:Moscow": "Europe (Moscow)", "Region:Virginia": "Eastern US (Virginia)", "Region:SiliconValley": "Western US (Silicon Valley)", - "Region:Toronto": "North America (Toronto)" + "Region:Toronto": "North America (Toronto)", + "Settings:TenantCloud": "Tenant Cloud", + "Settings:TenantCloud.ConnectionSetting": "Connection", + "Settings:TenantCloud.SmsSetting": "Sms", + "Settings:TenantCloud.BasicSetting": "Basic" } } \ No newline at end of file diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/zh-Hans.json b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/zh-Hans.json index cf0248289..56af3d15d 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/zh-Hans.json +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Localization/Resources/zh-Hans.json @@ -57,6 +57,10 @@ "Region:Moscow": "欧洲地区(莫斯科)", "Region:Virginia": "美国东部(弗吉尼亚)", "Region:SiliconValley": "美国西部(硅谷)", - "Region:Toronto": "北美地区(多伦多)" + "Region:Toronto": "北美地区(多伦多)", + "Settings:TenantCloud": "腾讯云服务", + "Settings:TenantCloud.ConnectionSetting": "连接配置", + "Settings:TenantCloud.SmsSetting": "短信配置", + "Settings:TenantCloud.BasicSetting": "基础配置" } } \ No newline at end of file diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs index 6f42d1828..f84acd5e0 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingDefinitionProvider.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.Tencent.Localization; +using LINGYUN.Abp.Tencent.Features; +using LINGYUN.Abp.Tencent.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +7,8 @@ namespace LINGYUN.Abp.Tencent.Settings; public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "TenantCloud"; + public override void Define(ISettingDefinitionContext context) { context.Add(GetBasicSettings()); @@ -29,7 +32,10 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("ConnectionSetting", L("Settings:TenantCloud.ConnectionSetting"), order: 0) + .WithOrder(0), new SettingDefinition( TencentCloudSettingNames.Connection.Timeout, // 默认 60秒 @@ -42,7 +48,11 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("ConnectionSetting", L("Settings:TenantCloud.ConnectionSetting"), order: 0) + .WithOrder(1) + .WithValueType(ValueType.Number), new SettingDefinition( TencentCloudSettingNames.Connection.WebProxy, displayName: L("DisplayName:WebProxy"), @@ -53,7 +63,10 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("ConnectionSetting", L("Settings:TenantCloud.ConnectionSetting"), order: 0) + .WithOrder(2), }; } @@ -72,7 +85,13 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:TenantCloud"), + requiredFeatures: [TencentCloudFeatures.Sms.Enable]) + .WithParent("SmsSetting", L("DisplayName:TenantCloud.SmsSetting"), order: 2) + .WithOrder(0), new SettingDefinition( TencentCloudSettingNames.Sms.DefaultSignName, displayName: L("DisplayName:DefaultSignName"), @@ -84,7 +103,13 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:TenantCloud"), + requiredFeatures: [TencentCloudFeatures.Sms.Enable]) + .WithParent("SmsSetting", L("DisplayName:TenantCloud.SmsSetting"), order: 2) + .WithOrder(1), new SettingDefinition( TencentCloudSettingNames.Sms.DefaultTemplateId, displayName: L("DisplayName:DefaultTemplateId"), @@ -96,7 +121,13 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:TenantCloud"), + requiredFeatures: [TencentCloudFeatures.Sms.Enable]) + .WithParent("SmsSetting", L("DisplayName:TenantCloud.SmsSetting"), order: 2) + .WithOrder(2), }; } @@ -116,7 +147,10 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("BasicSetting", L("DisplayName:TenantCloud.BasicSetting"), order: 1) + .WithOrder(0), new SettingDefinition( TencentCloudSettingNames.SecretId, displayName: L("DisplayName:SecretId"), @@ -128,7 +162,10 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("BasicSetting", L("DisplayName:TenantCloud.BasicSetting"), order: 1) + .WithOrder(1), new SettingDefinition( TencentCloudSettingNames.SecretKey, displayName: L("DisplayName:SecretKey"), @@ -140,7 +177,10 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("BasicSetting", L("DisplayName:TenantCloud.BasicSetting"), order: 1) + .WithOrder(2), new SettingDefinition( TencentCloudSettingNames.DurationSecond, defaultValue: "600", @@ -152,11 +192,15 @@ public class TencentCloudSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:TenantCloud")) + .WithParent("BasicSetting", L("DisplayName:TenantCloud.BasicSetting"), order: 1) + .WithOrder(3) + .WithValueType(ValueType.Number), }; } - private ILocalizableString L(string name) + private LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs index 65bd9aaa5..76925d1e8 100644 --- a/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs +++ b/aspnet-core/framework/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/Settings/TencentCloudSettingNames.cs @@ -20,6 +20,45 @@ public static class TencentCloudSettingNames /// public const string DurationSecond = Prefix + ".DurationSecond"; /// + /// 认证方式 + /// + public class Authorization + { + public const string Prefix = TencentCloudSettingNames.Prefix + ".Authorization"; + /// + /// 地域ID + /// + public const string RegionId = Prefix + ".RegionId"; + /// + /// RAM账号的AccessKey ID + /// + public const string AccessKeyId = Prefix + ".AccessKeyId"; + /// + /// RAM账号的AccessKey Secret + /// + public const string AccessKeySecret = Prefix + ".AccessKeySecret"; + /// + /// 使用STS Token访问 + /// + public const string UseSecurityTokenService = Prefix + ".UseSecurityTokenService"; + /// + /// 使用RAM子账号的AssumeRole方式访问 + /// + public const string RamRoleArn = Prefix + ".RamRoleArn"; + /// + /// 用户自定义参数。此参数用来区分不同的令牌,可用于用户级别的访问审计 + /// + public const string RoleSessionName = Prefix + ".RoleSessionName"; + /// + /// 过期时间,单位为秒。 + /// + public const string DurationSeconds = Prefix + ".DurationSeconds"; + /// + /// 权限策略。 + /// + public const string Policy = Prefix + ".Policy"; + } + /// /// 连接设置 /// public class Connection diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj index 377922e24..11dc914ef 100644 --- a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN.Abp.SettingManagement.Application.Contracts.csproj @@ -26,4 +26,8 @@ + + + + diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDetailsDto.cs b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDetailsDto.cs index 1c488302d..b7a6fe1f9 100644 --- a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDetailsDto.cs +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDetailsDto.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using Volo.Abp.Settings; namespace LINGYUN.Abp.SettingManagement; diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDto.cs b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDto.cs index 7288598a3..4ad3b84b4 100644 --- a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDto.cs +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/SettingDto.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; using Volo.Abp.Settings; +using ValueType = Volo.Abp.Settings.ValueType; namespace LINGYUN.Abp.SettingManagement; diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IReadonlySettingV2AppService.cs b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IReadonlySettingV2AppService.cs new file mode 100644 index 000000000..1eac33166 --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IReadonlySettingV2AppService.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.SettingManagement; + +public interface IReadonlySettingV2AppService : IApplicationService +{ + Task GetAsync(); +} diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/ISettingV2AppService.cs b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/ISettingV2AppService.cs new file mode 100644 index 000000000..c73f91d3c --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/ISettingV2AppService.cs @@ -0,0 +1,8 @@ +using System.Threading.Tasks; + +namespace LINGYUN.Abp.SettingManagement; + +public interface ISettingV2AppService : IReadonlySettingV2AppService +{ + Task SetAsync(UpdateSettingsDto input); +} diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IUserSettingV2AppService.cs b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IUserSettingV2AppService.cs new file mode 100644 index 000000000..cef206c07 --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/IUserSettingV2AppService.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.SettingManagement; + +public interface IUserSettingV2AppService : IApplicationService +{ + Task SetAsync(UpdateSettingsDto input); + + Task GetAsync(); +} diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/LINGYUN.Abp.Settings.csproj b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/LINGYUN.Abp.Settings.csproj index b1c22ea94..2a3e8f6a4 100644 --- a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/LINGYUN.Abp.Settings.csproj +++ b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/LINGYUN.Abp.Settings.csproj @@ -10,6 +10,7 @@ false false false + enable diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/ISettingProviderExtensions.cs b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/ISettingProviderExtensions.cs index f0b47e2b0..c77b28fd8 100644 --- a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/ISettingProviderExtensions.cs +++ b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/ISettingProviderExtensions.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.Settings; public static class ISettingProviderExtensions { - public static async Task GetOrDefaultAsync( + public static async Task GetOrDefaultAsync( [NotNull] this ISettingProvider settingProvider, [NotNull] string name, [NotNull] IServiceProvider serviceProvider) diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingDefinitionExtensions.cs b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingDefinitionExtensions.cs new file mode 100644 index 000000000..e273ad654 --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingDefinitionExtensions.cs @@ -0,0 +1,314 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Volo.Abp.Localization; + +namespace Volo.Abp.Settings; + +public static class SettingDefinitionExtensions +{ + private const string GroupKey = "Group"; + private const string ParentKey = "Parent"; + private const string OrderKey = "Order"; + private const string SlotKey = "Slot"; + private const string ValueTypeKey = "ValueType"; + private const string OptionNameKey = "OptionNames"; + private const string OptionValueKey = "OptionValues"; + private const string RequiredFeaturesKey = "RequiredFeatures"; + private const string RequiredPermissionsKey = "RequiredPermissions"; + + public static SettingDefinition RequiredFeatures( + this SettingDefinition definition, + IEnumerable requiredFeatures) + { + var existsRequiredFeatures = definition.GetRequiredFeatures(); + return definition + .WithProperty(RequiredFeaturesKey, existsRequiredFeatures.Union(requiredFeatures).JoinAsString(",")); + } + + public static SettingDefinition RequiredPermissions( + this SettingDefinition definition, + IEnumerable requiredPermissions) + { + var existsRequiredPermissions = definition.GetRequiredPermissions(); + return definition + .WithProperty(RequiredPermissionsKey, existsRequiredPermissions.Union(requiredPermissions).JoinAsString(",")); + } + + public static SettingDefinition WithSlot( + this SettingDefinition definition, + string slotName) + { + return definition + .WithProperty(SlotKey, slotName); + } + + public static SettingDefinition WithValueType( + this SettingDefinition definition, + ValueType valueType) + { + return definition + .WithProperty(ValueTypeKey, valueType.ToString()); + } + + public static SettingDefinition WithOrder( + this SettingDefinition definition, + int order) + { + return definition + .WithProperty(OrderKey, order.ToString()); + } + + public static SettingDefinition WithGroup( + this SettingDefinition definition, + string name, + string displayName, + int order = 0, + string[]? requiredFeatures = null, + string[]? requiredPermissions = null) + { + var groupDefinition = new SettingResourceDefinition( + name, + new FixedLocalizableString(displayName), + order, + requiredFeatures, + requiredPermissions); + + return definition + .WithProperty(GroupKey, groupDefinition.ToString()); + } + + public static SettingDefinition WithGroup( + this SettingDefinition definition, + string name, + LocalizableString displayName, + int order = 0, + string[]? requiredFeatures = null, + string[]? requiredPermissions = null) + { + var groupDefinition = new SettingResourceDefinition( + name, + displayName, + order, + requiredFeatures, + requiredPermissions); + + return definition + .WithProperty(GroupKey, groupDefinition.ToString()); + } + + public static SettingDefinition RequiredGroupFeatures( + this SettingDefinition definition, + string[] requiredFeatures) + { + var groupResource = definition.GetGroupOrNull(); + if (groupResource != null) + { + groupResource.RequiredFeatures = requiredFeatures + .Union(groupResource.RequiredFeatures ?? []) + .ToArray(); + + return definition + .WithProperty(GroupKey, groupResource.ToString()); + } + + return definition; + } + + public static SettingDefinition RequiredGroupPermissions( + this SettingDefinition definition, + string[] requiredPermissions) + { + var groupResource = definition.GetGroupOrNull(); + if (groupResource != null) + { + groupResource.RequiredPermissions = requiredPermissions + .Union(groupResource.RequiredPermissions ?? []) + .ToArray(); + + return definition + .WithProperty(GroupKey, groupResource.ToString()); + } + + return definition; + } + + public static SettingDefinition WithParent( + this SettingDefinition definition, + string name, + string displayName, + int order = 0, + string[]? requiredFeatures = null, + string[]? requiredPermissions = null) + { + var parentDefinition = new SettingResourceDefinition( + name, + new FixedLocalizableString(displayName), + order, + requiredFeatures, + requiredPermissions); + + return definition + .WithProperty(ParentKey, parentDefinition.ToString()); + } + + public static SettingDefinition WithParent( + this SettingDefinition definition, + string name, + LocalizableString displayName, + int order = 0, + string[]? requiredFeatures = null, + string[]? requiredPermissions = null) + { + var parentDefinition = new SettingResourceDefinition( + name, + displayName, + order, + requiredFeatures, + requiredPermissions); + + return definition + .WithProperty(ParentKey, parentDefinition.ToString()); + } + + public static SettingDefinition WithOptions( + this SettingDefinition definition, + IEnumerable> options) + { + var optionNames = options.Select(x => x.Name).JoinAsString(","); + var optionValues = options.Select(x => x.Value).JoinAsString(","); + + return definition + .WithValueType(ValueType.Option) + .WithProperty(OptionNameKey, optionNames) + .WithProperty(OptionValueKey, optionValues); + } + + public static SettingDefinition ReplaceProviders( + this SettingDefinition definition, + params string[] providers) + { + definition.Providers.Clear(); + + return definition.WithProviders(providers); + } + + public static string? GetSlotOrNull(this SettingDefinition definition) + { + if (definition.Properties.TryGetValue(SlotKey, out var slot) && slot != null) + { + return slot.ToString(); + } + + return null; + } + + public static ValueType GetValueTypeOrDefault(this SettingDefinition definition, ValueType defaultValueType = ValueType.String) + { + if (definition.Properties.TryGetValue(ValueTypeKey, out var valueTypeStr) && valueTypeStr != null && + Enum.TryParse(valueTypeStr.ToString(), out var valueType)) + { + return valueType; + } + + return defaultValueType; + } + + public static SettingResourceDefinition? GetGroupOrNull(this SettingDefinition definition) + { + return GetResourceOrNull(definition, GroupKey); + } + + public static SettingResourceDefinition? GetParentOrNull(this SettingDefinition definition) + { + return GetResourceOrNull(definition, ParentKey); + } + + public static IEnumerable> GetOptions(this SettingDefinition definition) + { + if (definition.TryGetArrayProperties(OptionNameKey, out var optionNames) && + definition.TryGetArrayProperties(OptionValueKey, out var optionValues)) + { + return optionNames.Select((name, index) => + { + return new NameValue(name, optionValues[index]); + }); + } + + return []; + } + + public static IEnumerable GetRequiredFeatures(this SettingDefinition definition) + { + definition.TryGetArrayProperties(RequiredFeaturesKey, out var requiredFeatures); + return requiredFeatures; + } + + public static IEnumerable GetRequiredPermissions(this SettingDefinition definition) + { + definition.TryGetArrayProperties(RequiredPermissionsKey, out var requiredPermissions); + return requiredPermissions; + } + + private static bool TryGetArrayProperties(this SettingDefinition definition, string propertyKey, out string[] enumerableProps) + { + if (definition.Properties.TryGetValue(propertyKey, out var propertyKeyValues) && propertyKeyValues != null) + { + enumerableProps = propertyKeyValues.ToString()!.Split(','); + return true; + } + enumerableProps = []; + return false; + } + + private static SettingResourceDefinition? GetResourceOrNull(SettingDefinition definition, string resourceKey) + { + if (definition.Properties.TryGetValue(resourceKey, out var resource) && resource != null) + { + var resourceDefineStr = resource.ToString(); + if (string.IsNullOrWhiteSpace(resourceDefineStr)) + { + return null; + } + var resourceDefineKeys = resourceDefineStr.Split(','); + if (resourceDefineKeys.Length < 6) + { + return null; + } + var name = resourceDefineKeys[0].Substring(2); + var displayName = resourceDefineKeys[1].Substring(2); + var resourceName = resourceDefineKeys[2]; + SettingResourceDefinition settingResource; + if (resourceName.Length > 2) + { + settingResource = new SettingResourceDefinition( + name, + new LocalizableString( + displayName, + resourceName.Substring(2))); + } + else + { + settingResource = new SettingResourceDefinition( + name, + new FixedLocalizableString(displayName)); + } + if (resourceDefineKeys[4].Length > 2) + { + settingResource.RequiredFeatures = resourceDefineKeys[4].Substring(2).Split(';'); + } + if (resourceDefineKeys[5].Length > 2) + { + settingResource.RequiredPermissions = resourceDefineKeys[5].Substring(2).Split(';'); + } + if (resourceDefineKeys[6].Length > 2 && int.TryParse(resourceDefineKeys[6].Substring(2), out var order)) + { + settingResource.Order = order; + } + + return settingResource; + } + + return null; + } +} diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingResourceDefinition.cs b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingResourceDefinition.cs new file mode 100644 index 000000000..e3285b588 --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/SettingResourceDefinition.cs @@ -0,0 +1,119 @@ +using Microsoft.Extensions.Localization; +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Abp.Localization; + +namespace Volo.Abp.Settings; + +public class SettingResourceDefinition +{ + public int Order { get; set; } + public string Name { get; set; } + public string? DisplayName { get; set; } + public string? ResourceName { get; set; } + public string? ResourceType { get; set; } + public string[]? RequiredFeatures { get; set; } + public string[]? RequiredPermissions { get; set; } + + public SettingResourceDefinition( + string name, + FixedLocalizableString displayName, + int order = 0, + string[]? requiredFeatures = null, + string[]? requiredPermissions = null) + { + Name = name; + Order = order; + DisplayName = displayName.Value; + RequiredFeatures = requiredFeatures; + RequiredPermissions = requiredPermissions; + } + + public SettingResourceDefinition( + string name, + LocalizableString displayName, + int order = 0, + string[]? requiredFeatures = null, + string[]? requiredPermissions = null) + { + Name = name; + Order = order; + ResourceName = displayName.ResourceName; + ResourceType = displayName.ResourceType?.FullName; + DisplayName = displayName.Name; + RequiredFeatures = requiredFeatures; + RequiredPermissions = requiredPermissions; + } + + public LocalizedString Localize(IStringLocalizerFactory stringLocalizerFactory) + { + if (!string.IsNullOrWhiteSpace(ResourceName) && + !string.IsNullOrWhiteSpace(DisplayName)) + { + if (!string.IsNullOrWhiteSpace(ResourceType)) + { + return new LocalizableString(DisplayName!, ResourceType).Localize(stringLocalizerFactory); + } + return new LocalizableString(DisplayName!, ResourceName).Localize(stringLocalizerFactory); + } + else if (!string.IsNullOrWhiteSpace(DisplayName)) + { + return new LocalizedString(Name!, DisplayName!); + } + return new LocalizedString(Name, Name); + } + + public override string ToString() + { + var sb = new StringBuilder(); + sb.AppendFormat("N:{0}", Name); + sb.AppendFormat(",D:{0}", DisplayName ?? string.Empty); + sb.AppendFormat(",L:{0}", ResourceName ?? string.Empty); + sb.AppendFormat(",T:{0}", ResourceType ?? string.Empty); + sb.AppendFormat(",F:{0}", RequiredFeatures?.JoinAsString(";") ?? string.Empty); + sb.AppendFormat(",P:{0}", RequiredPermissions?.JoinAsString(";") ?? string.Empty); + sb.AppendFormat(",O:{0}", Order); + + return sb.ToString(); + } + + public override bool Equals(object? obj) + { + if (obj == null) + { + return false; + } + if (obj is SettingResourceDefinition other) + { + return string.Equals(Name, other.Name, StringComparison.CurrentCultureIgnoreCase); + } + + return false; + } + + public override int GetHashCode() + { + return StringComparer.CurrentCultureIgnoreCase.GetHashCode(Name); + } + + public static bool operator ==(SettingResourceDefinition? left, SettingResourceDefinition? right) + { + if (ReferenceEquals(left, right)) + { + return true; + } + + if (left is null || right is null) + { + return false; + } + + return left.Equals(right); + } + + public static bool operator !=(SettingResourceDefinition? left, SettingResourceDefinition? right) + { + return !(left == right); + } +} diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/ValueType.cs similarity index 93% rename from aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs rename to aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/ValueType.cs index 000cc6c14..8288919a2 100644 --- a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/LINGYUN/Abp/SettingManagement/Dto/ValueType.cs +++ b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/Volo/Abp/Settings/ValueType.cs @@ -1,4 +1,4 @@ -namespace LINGYUN.Abp.SettingManagement; +namespace Volo.Abp.Settings; public enum ValueType { diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/en.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/en.json index e7026f595..86c74c226 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/en.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/en.json @@ -24,6 +24,7 @@ "Features:WeChat.MiniProgram.SendLimit": "Send Limit", "Features:WeChat.MiniProgram.SendLimitDesc": "Limit wechat applet template message certain period", "Features:WeChat.MiniProgram.SendLimitInterval": "Send Duration", - "Features:WeChat.MiniProgram.SendLimitIntervalDesc": "Limit template message can be invoked, unit is Month" + "Features:WeChat.MiniProgram.SendLimitIntervalDesc": "Limit template message can be invoked, unit is Month", + "Settings:WeChat.MiniProgram": "WeChat Mini Program" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/zh-Hans.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/zh-Hans.json index e09f24529..1abfaf7ba 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/zh-Hans.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Localization/Resources/zh-Hans.json @@ -24,6 +24,7 @@ "Features:WeChat.MiniProgram.SendLimit": "发送消息限制", "Features:WeChat.MiniProgram.SendLimitDesc": "在一定周期内限制微信小程序模板消息调用上限", "Features:WeChat.MiniProgram.SendLimitInterval": "发送消息限制时长", - "Features:WeChat.MiniProgram.SendLimitIntervalDesc": "限制模板消息调用上限的时长,周期为月" + "Features:WeChat.MiniProgram.SendLimitIntervalDesc": "限制模板消息调用上限的时长,周期为月", + "Settings:WeChat.MiniProgram": "微信小程序" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Settings/WeChatMiniProgramSettingDefinitionProvider.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Settings/WeChatMiniProgramSettingDefinitionProvider.cs index f01767e8f..1e838849d 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Settings/WeChatMiniProgramSettingDefinitionProvider.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.MiniProgram/LINGYUN/Abp/WeChat/MiniProgram/Settings/WeChatMiniProgramSettingDefinitionProvider.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.WeChat.Localization; +using LINGYUN.Abp.WeChat.MiniProgram.Features; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +7,7 @@ namespace LINGYUN.Abp.WeChat.MiniProgram.Settings; public class WeChatMiniProgramSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "WeChat"; public override void Define(ISettingDefinitionContext context) { context.Add( @@ -19,7 +21,13 @@ public class WeChatMiniProgramSettingDefinitionProvider : SettingDefinitionProvi DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChat"), + requiredFeatures: [WeChatMiniProgramFeatures.Enable]) + .WithParent("MiniProgram", L("Settings:WeChat.MiniProgram"), order: 1) + .WithOrder(0), new SettingDefinition( WeChatMiniProgramSettingNames.AppSecret, "", L("DisplayName:WeChat.MiniProgram.AppSecret"), @@ -30,7 +38,13 @@ public class WeChatMiniProgramSettingDefinitionProvider : SettingDefinitionProvi DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChat"), + requiredFeatures: [WeChatMiniProgramFeatures.Enable]) + .WithParent("MiniProgram", L("Settings:WeChat.MiniProgram"), order: 1) + .WithOrder(1), new SettingDefinition( WeChatMiniProgramSettingNames.Token, "", L("DisplayName:WeChat.MiniProgram.Token"), @@ -41,7 +55,13 @@ public class WeChatMiniProgramSettingDefinitionProvider : SettingDefinitionProvi DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChat"), + requiredFeatures: [WeChatMiniProgramFeatures.Enable]) + .WithParent("MiniProgram", L("Settings:WeChat.MiniProgram"), order: 1) + .WithOrder(2), new SettingDefinition( WeChatMiniProgramSettingNames.EncodingAESKey, "", L("DisplayName:WeChat.MiniProgram.EncodingAESKey"), @@ -53,10 +73,16 @@ public class WeChatMiniProgramSettingDefinitionProvider : SettingDefinitionProvi ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChat"), + requiredFeatures: [WeChatMiniProgramFeatures.Enable]) + .WithParent("MiniProgram", L("Settings:WeChat.MiniProgram"), order: 1) + .WithOrder(3) ); } - protected ILocalizableString L(string name) + protected LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/en.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/en.json index 125dcd1e1..0d26cfa08 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/en.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/en.json @@ -14,6 +14,7 @@ "DisplayName:WeChat.Official.Token": "Token", "Description:WeChat.Official.Token": "Token,See:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html", "DisplayName:WeChat.Official.EncodingAESKey": "Encoding AES Key", - "Description:WeChat.Official.EncodingAESKey": "Encoding AES Key,See:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html" + "Description:WeChat.Official.EncodingAESKey": "Encoding AES Key,See:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html", + "Settings:WeChat.Official": "WeChat Official" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/zh-Hans.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/zh-Hans.json index 9f0f4124d..4d9f268cd 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/zh-Hans.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Localization/Resources/zh-Hans.json @@ -16,6 +16,7 @@ "DisplayName:WeChat.Official.Token": "公众号Token", "Description:WeChat.Official.Token": "微信公众号Token,详情见:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html", "DisplayName:WeChat.Official.EncodingAESKey": "公众号EncodingAESKey", - "Description:WeChat.Official.EncodingAESKey": "微信公众号EncodingAESKey,详情见:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html" + "Description:WeChat.Official.EncodingAESKey": "微信公众号EncodingAESKey,详情见:https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html", + "Settings:WeChat.Official": "微信公众号" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Settings/WeChatOfficialSettingDefinitionProvider.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Settings/WeChatOfficialSettingDefinitionProvider.cs index 22144d7ab..7a46dd3be 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Settings/WeChatOfficialSettingDefinitionProvider.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Official/LINGYUN/Abp/WeChat/Official/Settings/WeChatOfficialSettingDefinitionProvider.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.WeChat.Localization; +using LINGYUN.Abp.WeChat.Official.Features; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +7,7 @@ namespace LINGYUN.Abp.WeChat.Official.Settings; public class WeChatOfficialSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "WeChat"; public override void Define(ISettingDefinitionContext context) { context.Add( @@ -20,7 +22,14 @@ public class WeChatOfficialSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:WeChat")) + .WithParent( + "Official", + L("Settings:WeChat.Official"), + requiredFeatures: [WeChatOfficialFeatures.Enable], order: 2) + .WithOrder(0) + .WithValueType(ValueType.Boolean), new SettingDefinition( WeChatOfficialSettingNames.AppId, "", L("DisplayName:WeChat.Official.AppId"), @@ -31,7 +40,13 @@ public class WeChatOfficialSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:WeChat")) + .WithParent( + "Official", + L("Settings:WeChat.Official"), + requiredFeatures: [WeChatOfficialFeatures.Enable], order: 2) + .WithOrder(1), new SettingDefinition( WeChatOfficialSettingNames.AppSecret, "", L("DisplayName:WeChat.Official.AppSecret"), @@ -42,7 +57,13 @@ public class WeChatOfficialSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:WeChat")) + .WithParent( + "Official", + L("Settings:WeChat.Official"), + requiredFeatures: [WeChatOfficialFeatures.Enable], order: 2) + .WithOrder(2), new SettingDefinition( WeChatOfficialSettingNames.Url, "", L("DisplayName:WeChat.Official.Url"), @@ -53,7 +74,13 @@ public class WeChatOfficialSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:WeChat")) + .WithParent( + "Official", + L("Settings:WeChat.Official"), + requiredFeatures: [WeChatOfficialFeatures.Enable], order: 2) + .WithOrder(3), new SettingDefinition( WeChatOfficialSettingNames.Token, "", L("DisplayName:WeChat.Official.Token"), @@ -64,7 +91,13 @@ public class WeChatOfficialSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:WeChat")) + .WithParent( + "Official", + L("Settings:WeChat.Official"), + requiredFeatures: [WeChatOfficialFeatures.Enable], order: 2) + .WithOrder(4), new SettingDefinition( WeChatOfficialSettingNames.EncodingAESKey, "", L("DisplayName:WeChat.Official.EncodingAESKey"), @@ -76,10 +109,16 @@ public class WeChatOfficialSettingDefinitionProvider : SettingDefinitionProvider ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:WeChat")) + .WithParent( + "Official", + L("Settings:WeChat.Official"), + requiredFeatures: [WeChatOfficialFeatures.Enable], order: 2) + .WithOrder(5) ); } - protected ILocalizableString L(string name) + protected LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/en.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/en.json index 220b6cda1..228af7edc 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/en.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/en.json @@ -6,6 +6,7 @@ "Features:ContactsEnable": "Enable Contacts", "Features:ContactsEnableDesc": "Enable the ability to provide the application with an Enterprise wechat contacts interface.", "DisplayName:WeChatWorkContact.Secret": "Contact Secret", - "Description:WeChatWorkContact.Secret": "Secretfor the address contact application. Some contact interfaces require a contact synchronization secret." + "Description:WeChatWorkContact.Secret": "Secretfor the address contact application. Some contact interfaces require a contact synchronization secret.", + "Settings:WeChatWork.WeChatWorkContact": "Contacts" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/zh-Hans.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/zh-Hans.json index acfe3b0a1..0bccc98a9 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/zh-Hans.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Localization/Resources/zh-Hans.json @@ -6,6 +6,7 @@ "Features:ContactsEnable": "启用通讯录", "Features:ContactsEnableDesc": "启用以使应用拥有企业微信通讯录接口的能力.", "DisplayName:WeChatWorkContact.Secret": "通讯录访问密钥", - "Description:WeChatWorkContact.Secret": "通讯录应用访问密钥,部分通讯录接口需要通讯录同步secret." + "Description:WeChatWorkContact.Secret": "通讯录应用访问密钥,部分通讯录接口需要通讯录同步secret.", + "Settings:WeChatWork.WeChatWorkContact": "通讯录" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Settings/WeChatWorkContactSettingDefinitionProvider.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Settings/WeChatWorkContactSettingDefinitionProvider.cs index dc6234c7b..9f4e0d1d9 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Settings/WeChatWorkContactSettingDefinitionProvider.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.Contacts/LINGYUN/Abp/WeChat/Work/Contacts/Settings/WeChatWorkContactSettingDefinitionProvider.cs @@ -1,4 +1,6 @@ -using LINGYUN.Abp.WeChat.Work.Localization; +using LINGYUN.Abp.WeChat.Work.Contacts.Features; +using LINGYUN.Abp.WeChat.Work.Features; +using LINGYUN.Abp.WeChat.Work.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +8,7 @@ namespace LINGYUN.Abp.WeChat.Work.Contacts.Settings; public class WeChatWorkContactSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "WeChatWork"; public override void Define(ISettingDefinitionContext context) { context.Add( @@ -20,10 +23,19 @@ public class WeChatWorkContactSettingDefinitionProvider : SettingDefinitionProvi ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent( + "WeChatWorkContact", + L("Settings:WeChatWork.WeChatWorkContact"), + requiredFeatures: [WeChatWorkContactsFeatureNames.Enable], order: 3) + .WithOrder(0) ); } - private static ILocalizableString L(string name) + private static LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/en.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/en.json index c5771d568..5ae43058d 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/en.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/en.json @@ -6,6 +6,7 @@ "Features:ExternalContactEnable": "Enable External Contact", "Features:ExternalContactEnableDesc": "Enable the ability to provide the application with an Enterprise wechat customer contact interface.", "DisplayName:WeChatWorkExternalContact.Secret": "External Contact Secret", - "Description:WeChatWorkExternalContact.Secret": "Customer contact application access key, some customer contact interfaces require customer contact application secret." + "Description:WeChatWorkExternalContact.Secret": "Customer contact application access key, some customer contact interfaces require customer contact application secret.", + "Settings:WeChatWork.WeChatWorkExternalContact": "External Contact" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/zh-Hans.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/zh-Hans.json index 89b15b6ba..f1dfdf81c 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/zh-Hans.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Localization/Resources/zh-Hans.json @@ -6,6 +6,7 @@ "Features:ExternalContactEnable": "启用客户联系", "Features:ExternalContactEnableDesc": "启用以使应用拥有企业微信客户联系接口的能力.", "DisplayName:WeChatWorkExternalContact.Secret": "客户联系访问密钥", - "Description:WeChatWorkExternalContact.Secret": "客户联系应用访问密钥,部分客户联系接口需要客户联系应用secret." + "Description:WeChatWorkExternalContact.Secret": "客户联系应用访问密钥,部分客户联系接口需要客户联系应用secret.", + "Settings:WeChatWork.WeChatWorkExternalContact": "客户联系" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Settings/WeChatWorkExternalContactSettingDefinitionProvider.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Settings/WeChatWorkExternalContactSettingDefinitionProvider.cs index 14743d89d..67de39da4 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Settings/WeChatWorkExternalContactSettingDefinitionProvider.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work.ExternalContact/LINGYUN/Abp/WeChat/Work/ExternalContact/Settings/WeChatWorkExternalContactSettingDefinitionProvider.cs @@ -1,4 +1,6 @@ -using LINGYUN.Abp.WeChat.Work.Localization; +using LINGYUN.Abp.WeChat.Work.ExternalContact.Features; +using LINGYUN.Abp.WeChat.Work.Features; +using LINGYUN.Abp.WeChat.Work.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +8,7 @@ namespace LINGYUN.Abp.WeChat.Work.ExternalContact.Settings; public class WeChatWorkExternalContactSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "WeChatWork"; public override void Define(ISettingDefinitionContext context) { context.Add( @@ -20,10 +23,19 @@ public class WeChatWorkExternalContactSettingDefinitionProvider : SettingDefinit ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent( + "WeChatWorkExternalContact", + L("Settings:WeChatWork.WeChatWorkExternalContact"), + requiredFeatures: [WeChatWorkExternalContactFeatureNames.Enable], order: 4) + .WithOrder(0) ); } - private static ILocalizableString L(string name) + private static LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN.Abp.WeChat.Work.csproj b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN.Abp.WeChat.Work.csproj index dc4b33b04..be0c19238 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN.Abp.WeChat.Work.csproj +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN.Abp.WeChat.Work.csproj @@ -29,6 +29,7 @@ + diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/en.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/en.json index 1b59d4f25..517659308 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/en.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/en.json @@ -76,6 +76,9 @@ "WeChatWork:40009": "上传图片大小不是有效值,参考:https://developer.work.weixin.qq.com/document/path/90313#10112/%E4%B8%8A%E4%BC%A0%E7%9A%84%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6", "WeChatWork:40011": "上传视频大小不是有效值,参考:https://developer.work.weixin.qq.com/document/path/90313#10112/%E4%B8%8A%E4%BC%A0%E7%9A%84%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6", "WeChatWork:40013": "不合法的CorpID", - "WeChatWork:40014": "不合法的access_token,参考:https://developer.work.weixin.qq.com/document/path/90313#10649/%E9%94%99%E8%AF%AF%E7%A0%81%EF%BC%9A40014" + "WeChatWork:40014": "不合法的access_token,参考:https://developer.work.weixin.qq.com/document/path/90313#10649/%E9%94%99%E8%AF%AF%E7%A0%81%EF%BC%9A40014", + "Settings:WeChatWork": "WeChat Work", + "Settings:WeChatWork.UserLogin": "User Login", + "Settings:WeChatWork.Connection": "Connection" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/zh-Hans.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/zh-Hans.json index dc1138b07..20c182d85 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/zh-Hans.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Localization/Resources/zh-Hans.json @@ -76,6 +76,9 @@ "WeChatWork:40009": "上传图片大小不是有效值,参考:https://developer.work.weixin.qq.com/document/path/90313#10112/%E4%B8%8A%E4%BC%A0%E7%9A%84%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6", "WeChatWork:40011": "上传视频大小不是有效值,参考:https://developer.work.weixin.qq.com/document/path/90313#10112/%E4%B8%8A%E4%BC%A0%E7%9A%84%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6%E9%99%90%E5%88%B6", "WeChatWork:40013": "不合法的CorpID", - "WeChatWork:40014": "不合法的access_token,参考:https://developer.work.weixin.qq.com/document/path/90313#10649/%E9%94%99%E8%AF%AF%E7%A0%81%EF%BC%9A40014" + "WeChatWork:40014": "不合法的access_token,参考:https://developer.work.weixin.qq.com/document/path/90313#10649/%E9%94%99%E8%AF%AF%E7%A0%81%EF%BC%9A40014", + "Settings:WeChatWork": "企业微信", + "Settings:WeChatWork.UserLogin": "用户登录", + "Settings:WeChatWork.Connection": "连接配置" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Settings/WeChatWorkSettingDefinitionProvider.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Settings/WeChatWorkSettingDefinitionProvider.cs index 33181b4e6..eb8d8aa0a 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Settings/WeChatWorkSettingDefinitionProvider.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat.Work/LINGYUN/Abp/WeChat/Work/Settings/WeChatWorkSettingDefinitionProvider.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.WeChat.Work.Localization; +using LINGYUN.Abp.WeChat.Work.Features; +using LINGYUN.Abp.WeChat.Work.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +7,7 @@ namespace LINGYUN.Abp.WeChat.Work.Settings; public class WeChatWorkSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "WeChatWork"; public override void Define(ISettingDefinitionContext context) { context.Add( @@ -22,6 +24,13 @@ public class WeChatWorkSettingDefinitionProvider : SettingDefinitionProvider ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent("UserLogin", L("Settings:WeChatWork.UserLogin"), order: 1) + .WithOrder(0) + .WithValueType(ValueType.Boolean) ); context.Add(GetConnectionSettings()); } @@ -39,7 +48,13 @@ public class WeChatWorkSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent("Connection", L("Settings:WeChatWork.Connection"), order: 2) + .WithOrder(0), new SettingDefinition( WeChatWorkSettingNames.Connection.AgentId, @@ -50,7 +65,13 @@ public class WeChatWorkSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent("Connection", L("Settings:WeChatWork.Connection"), order: 2) + .WithOrder(1), new SettingDefinition( WeChatWorkSettingNames.Connection.Secret, displayName: L("DisplayName:WeChatWork.Connection.Secret"), @@ -60,7 +81,13 @@ public class WeChatWorkSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent("Connection", L("Settings:WeChatWork.Connection"), order: 2) + .WithOrder(2), new SettingDefinition( WeChatWorkSettingNames.Connection.Token, displayName: L("DisplayName:WeChatWork.Connection.Token"), @@ -70,7 +97,13 @@ public class WeChatWorkSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent("Connection", L("Settings:WeChatWork.Connection"), order: 2) + .WithOrder(3), new SettingDefinition( WeChatWorkSettingNames.Connection.EncodingAESKey, displayName: L("DisplayName:WeChatWork.Connection.EncodingAESKey"), @@ -80,11 +113,17 @@ public class WeChatWorkSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:WeChatWork"), + requiredFeatures: [WeChatWorkFeatureNames.Enable]) + .WithParent("Connection", L("Settings:WeChatWork.Connection"), order: 2) + .WithOrder(4), }; } - protected ILocalizableString L(string name) + protected LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj index 830a2dd39..3f51d3464 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN.Abp.WeChat.csproj @@ -29,6 +29,7 @@ + diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json index 08d22a9e3..8fac2480d 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/en.json @@ -7,6 +7,8 @@ "Description:WeChat": "WeChat", "UserLogin": "User Login", "DisplayName:WeChat.EnabledQuickLogin": "Enabled Quick Login", - "Description:WeChat.EnabledQuickLogin": "Users can login directly with the code given by wx.login when they are not registered" + "Description:WeChat.EnabledQuickLogin": "Users can login directly with the code given by wx.login when they are not registered", + "Settings:WeChat": "WeChat", + "Settings:WeChat.UserLogin": "User Login" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json index 81c06a287..eab66bc98 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Localization/Resources/zh-Hans.json @@ -7,6 +7,8 @@ "Description:WeChat": "微信开发平台", "UserLogin": "用户登录", "DisplayName:WeChat.EnabledQuickLogin": "启用快捷登录", - "Description:WeChat.EnabledQuickLogin": "用户可在未注册时通过 wx.login 得到的code直接登录" + "Description:WeChat.EnabledQuickLogin": "用户可在未注册时通过 wx.login 得到的code直接登录", + "Settings:WeChat": "微信开发", + "Settings:WeChat.UserLogin": "用户登录" } } \ No newline at end of file diff --git a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Settings/WeChatSettingDefinitionProvider.cs b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Settings/WeChatSettingDefinitionProvider.cs index feb0844b3..0a093772d 100644 --- a/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Settings/WeChatSettingDefinitionProvider.cs +++ b/aspnet-core/framework/wechat/LINGYUN.Abp.WeChat/LINGYUN/Abp/WeChat/Settings/WeChatSettingDefinitionProvider.cs @@ -6,6 +6,8 @@ namespace LINGYUN.Abp.WeChat.Settings; public class WeChatSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "WeChat"; + public override void Define(ISettingDefinitionContext context) { context.Add( @@ -22,10 +24,14 @@ public class WeChatSettingDefinitionProvider : SettingDefinitionProvider ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:WeChat")) + .WithParent("UserLogin", L("Settings:WeChat.UserLogin"), order: 0) + .WithOrder(0) + .WithValueType(ValueType.Boolean) ); } - protected ILocalizableString L(string name) + protected LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountGroupSettingDefinitionProvider.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountGroupSettingDefinitionProvider.cs new file mode 100644 index 000000000..7244255cf --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountGroupSettingDefinitionProvider.cs @@ -0,0 +1,31 @@ +using Volo.Abp.Account.Localization; +using Volo.Abp.Account.Settings; +using Volo.Abp.Localization; +using Volo.Abp.Settings; +using ValueType = Volo.Abp.Settings.ValueType; + +namespace LINGYUN.Abp.Account; + +public class AccountGroupSettingDefinitionProvider : SettingDefinitionProvider +{ + private const string GroupName = "Identity"; + private const int GroupOrder = 10; + public override void Define(ISettingDefinitionContext context) + { + context.GetOrNull(AccountSettingNames.EnableLocalLogin) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Account", L("Settings:Identity.Account"), order: 0) + ?.WithOrder(0) + ?.WithValueType(ValueType.Boolean); + context.GetOrNull(AccountSettingNames.IsSelfRegistrationEnabled) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Account", L("Settings:Identity.Account"), order: 0) + ?.WithOrder(1) + ?.WithValueType(ValueType.Boolean); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } +} diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN.Abp.Account.OAuth.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN.Abp.Account.OAuth.csproj index d097d8b31..30eaf6d9b 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN.Abp.Account.OAuth.csproj +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN.Abp.Account.OAuth.csproj @@ -23,4 +23,8 @@ + + + + diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN/Abp/Account/OAuth/Settings/AccountOAuthSettingDefinitionProvider.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN/Abp/Account/OAuth/Settings/AccountOAuthSettingDefinitionProvider.cs index dba71ecbf..d8d1da0b2 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN/Abp/Account/OAuth/Settings/AccountOAuthSettingDefinitionProvider.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.OAuth/LINGYUN/Abp/Account/OAuth/Settings/AccountOAuthSettingDefinitionProvider.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.Account.OAuth.Localization; +using LINGYUN.Abp.Account.OAuth.Features; +using LINGYUN.Abp.Account.OAuth.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +7,8 @@ namespace LINGYUN.Abp.Account.OAuth.Settings; public class AccountOAuthSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "ExternalOAuthLogin"; + public override void Define(ISettingDefinitionContext context) { context.Add(GetGitHubSettings()); @@ -26,7 +29,10 @@ public class AccountOAuthSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:ExternalOAuthLogin")) + .WithParent("GitHubAuth", L("Settings:GitHubAuth")) + .RequiredFeatures([AccountOAuthFeatureNames.GitHub.Enable]), new SettingDefinition( AccountOAuthSettingNames.GitHub.ClientSecret, displayName: L("Settings:GitHubClientSecret"), @@ -37,7 +43,10 @@ public class AccountOAuthSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:ExternalOAuthLogin")) + .WithParent("GitHubAuth", L("Settings:GitHubAuth")) + .RequiredFeatures([AccountOAuthFeatureNames.GitHub.Enable]), }; } @@ -55,7 +64,10 @@ public class AccountOAuthSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:ExternalOAuthLogin")) + .WithParent("Bilibili", L("Settings:BilibiliAuth")) + .RequiredFeatures([AccountOAuthFeatureNames.Bilibili.Enable]), new SettingDefinition( AccountOAuthSettingNames.Bilibili.ClientSecret, displayName: L("Settings:BilibiliClientSecret"), @@ -66,11 +78,14 @@ public class AccountOAuthSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:ExternalOAuthLogin")) + .WithParent("Bilibili", L("Settings:BilibiliAuth")) + .RequiredFeatures([AccountOAuthFeatureNames.Bilibili.Enable]), }; } - protected ILocalizableString L(string name) + protected LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/en.json b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/en.json index df80fdea6..5eb375163 100644 --- a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/en.json +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/en.json @@ -60,6 +60,8 @@ "Propertites": "Propertites", "Tools:New": "New Tool", "Tools:Edit": "Edit Tool", - "DesignConversationNamePrompt": "Based on the user's question, generate a concise and descriptive conversation title, with the length limited to {0} characters or less." + "DesignConversationNamePrompt": "Based on the user's question, generate a concise and descriptive conversation title, with the length limited to {0} characters or less.", + "Settings:AIManagement": "Artificia Intelligence", + "Settings:AIManagement.ChatMessage": "Chats" } } \ No newline at end of file diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/zh-Hans.json index 9004b5a3b..5c97079d8 100644 --- a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain.Shared/LINGYUN/Abp/AIManagement/Localization/Resources/zh-Hans.json @@ -60,6 +60,8 @@ "Propertites": "属性", "Tools:New": "新工具", "Tools:Edit": "编辑工具", - "DesignConversationNamePrompt": "根据用户的提问, 生成一个简短且具有描述性的对话名称, 长度必须控制在 {0} 个字符以内." + "DesignConversationNamePrompt": "根据用户的提问, 生成一个简短且具有描述性的对话名称, 长度必须控制在 {0} 个字符以内.", + "Settings:AIManagement": "人工智能", + "Settings:AIManagement.ChatMessage": "对话管理" } } \ No newline at end of file diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN.Abp.AIManagement.Domain.csproj b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN.Abp.AIManagement.Domain.csproj index 390c80eb8..43b66c12b 100644 --- a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN.Abp.AIManagement.Domain.csproj +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN.Abp.AIManagement.Domain.csproj @@ -23,6 +23,7 @@ + diff --git a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN/Abp/AIManagement/Settings/AIManagementSettingDefinitionProvider.cs b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN/Abp/AIManagement/Settings/AIManagementSettingDefinitionProvider.cs index e36886420..0ab341956 100644 --- a/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN/Abp/AIManagement/Settings/AIManagementSettingDefinitionProvider.cs +++ b/aspnet-core/modules/ai/LINGYUN.Abp.AIManagement.Domain/LINGYUN/Abp/AIManagement/Settings/AIManagementSettingDefinitionProvider.cs @@ -5,6 +5,7 @@ using Volo.Abp.Settings; namespace LINGYUN.Abp.AIManagement.Settings; public class AIManagementSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "AIManagement"; public override void Define(ISettingDefinitionContext context) { context.Add( @@ -12,10 +13,19 @@ public class AIManagementSettingDefinitionProvider : SettingDefinitionProvider AIManagementSettingNames.ChatMessage.MaxLatestHistoryMessagesToKeep, defaultValue: "5", displayName: L("DisplayName:MaxLatestHistoryMessagesToKeep"), - description: L("Description:MaxLatestHistoryMessagesToKeep"))); + description: L("Description:MaxLatestHistoryMessagesToKeep")) + .WithProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:AIManagement")) + .WithParent("ChatMessage", L("Settings:AIManagement.ChatMessage")) + .WithValueType(ValueType.Number) + ); } - private static ILocalizableString L(string name) + private static LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/BlobManagementPermissionSettingDefinitionProvider.cs b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/BlobManagementPermissionSettingDefinitionProvider.cs new file mode 100644 index 000000000..c790d8aee --- /dev/null +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Application/LINGYUN/Abp/BlobManagement/BlobManagementPermissionSettingDefinitionProvider.cs @@ -0,0 +1,18 @@ +using LINGYUN.Abp.BlobManagement.Permissions; +using LINGYUN.Abp.BlobManagement.Settings; +using Volo.Abp.Settings; + +namespace LINGYUN.Abp.BlobManagement; + +public class BlobManagementPermissionSettingDefinitionProvider : SettingDefinitionProvider +{ + public override void Define(ISettingDefinitionContext context) + { + context.GetOrNull(BlobManagementSettingNames.GenerateDownloadUrlExpirySeconds) + ?.RequiredGroupPermissions([BlobManagementPermissionNames.Blob.Default]); + context.GetOrNull(BlobManagementSettingNames.FileLimitLength) + ?.RequiredGroupPermissions([BlobManagementPermissionNames.Blob.Default]); + context.GetOrNull(BlobManagementSettingNames.AllowFileExtensions) + ?.RequiredGroupPermissions([BlobManagementPermissionNames.Blob.Default]); + } +} diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN.Abp.BlobManagement.Domain.Shared.csproj b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN.Abp.BlobManagement.Domain.Shared.csproj index f42e52994..9b17ae78b 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN.Abp.BlobManagement.Domain.Shared.csproj +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN.Abp.BlobManagement.Domain.Shared.csproj @@ -24,4 +24,8 @@ + + + + diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/en.json b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/en.json index 7babc31ef..9fe94e364 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/en.json +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/en.json @@ -75,6 +75,8 @@ "UploadStatus:Error": "Error", "UploadStatus:Pause": "Pause", "BlobWellDownloadMessage": "The file download is about to start.", - "BlobCanNotPreviewMessage": "This file does not support previewing. Please download it and view it!" + "BlobCanNotPreviewMessage": "This file does not support previewing. Please download it and view it!", + "Settings:BlobManagement": "Blob Management", + "Settings:BlobManagement.Blobs": "Blobs" } } \ No newline at end of file diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/zh-Hans.json index 59f356251..35a8c044f 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Localization/Resources/zh-Hans.json @@ -75,6 +75,8 @@ "UploadStatus:Error": "错误", "UploadStatus:Pause": "暂停", "BlobWellDownloadMessage": "即将开始下载文件.", - "BlobCanNotPreviewMessage": "此文件不支持预览,请下载后查看!" + "BlobCanNotPreviewMessage": "此文件不支持预览,请下载后查看!", + "Settings:BlobManagement": "对象存储", + "Settings:BlobManagement.Blobs": "存储管理" } } \ No newline at end of file diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Settings/BlobManagementSettingDefinitionProvider.cs b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Settings/BlobManagementSettingDefinitionProvider.cs index e8d1f886f..85fadd703 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Settings/BlobManagementSettingDefinitionProvider.cs +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.Domain.Shared/LINGYUN/Abp/BlobManagement/Settings/BlobManagementSettingDefinitionProvider.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.BlobManagement.Localization; +using LINGYUN.Abp.BlobManagement.Features; +using LINGYUN.Abp.BlobManagement.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,6 +7,7 @@ namespace LINGYUN.Abp.BlobManagement.Settings; public class BlobManagementSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "BlobManagement"; public override void Define(ISettingDefinitionContext context) { context.Add(CreateBlobFileSettings()); @@ -25,7 +27,13 @@ public class BlobManagementSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:BlobManagement"), + requiredFeatures: [BlobManagementFeatureNames.Blob.Enable]) + .WithParent("Blobs", L("Settings:BlobManagement.Blobs")) + .WithValueType(ValueType.Number), new SettingDefinition( name: BlobManagementSettingNames.AllowFileExtensions, defaultValue: BlobManagementSettingNames.DefaultAllowFileExtensions, @@ -36,18 +44,29 @@ public class BlobManagementSettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:BlobManagement"), + requiredFeatures: [BlobManagementFeatureNames.Blob.Enable]) + .WithParent("Blobs", L("Settings:BlobManagement.Blobs")), new SettingDefinition( name: BlobManagementSettingNames.GenerateDownloadUrlExpirySeconds, defaultValue: BlobManagementSettingNames.DefaultGenerateDownloadUrlExpirySeconds.ToString(), displayName: L("DisplayName:GenerateDownloadUrlExpirySeconds"), description: L("Description:GenerateDownloadUrlExpirySeconds"), - isVisibleToClients: true) + isVisibleToClients: false) .WithProviders( DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup( + GroupName, + L("Settings:BlobManagement"), + requiredFeatures: [BlobManagementFeatureNames.Blob.Enable]) + .WithParent("Blobs", L("Settings:BlobManagement.Blobs")) + .WithValueType(ValueType.Number), }; } diff --git a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.SettingManagement/LINGYUN/Abp/BlobManagement/SettingManagement/BlobManagementSettingAppService.cs b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.SettingManagement/LINGYUN/Abp/BlobManagement/SettingManagement/BlobManagementSettingAppService.cs index 1a6cfa5e1..bf3fb06bc 100644 --- a/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.SettingManagement/LINGYUN/Abp/BlobManagement/SettingManagement/BlobManagementSettingAppService.cs +++ b/aspnet-core/modules/blob-management/LINGYUN.Abp.BlobManagement.SettingManagement/LINGYUN/Abp/BlobManagement/SettingManagement/BlobManagementSettingAppService.cs @@ -9,7 +9,7 @@ using Volo.Abp.Authorization.Permissions; using Volo.Abp.MultiTenancy; using Volo.Abp.SettingManagement; using Volo.Abp.Settings; -using ValueType = LINGYUN.Abp.SettingManagement.ValueType; +using ValueType = Volo.Abp.Settings.ValueType; namespace LINGYUN.Abp.BlobManagement.SettingManagement; diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN.Abp.Identity.Domain.Shared.csproj b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN.Abp.Identity.Domain.Shared.csproj index 14dc78e74..8aea49bef 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN.Abp.Identity.Domain.Shared.csproj +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN.Abp.Identity.Domain.Shared.csproj @@ -27,4 +27,8 @@ + + + + diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json index 80d38aba9..1059016d6 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/en.json @@ -116,6 +116,14 @@ "CurrentSession": "Current Session", "RevokeSession": "Revoke Session", "SessionWillBeRevokedMessage": "The selected session will be revoked, which will invalidate the user's login!", - "SuccessfullyRevoked": "Successful session revoked" + "SuccessfullyRevoked": "Successful session revoked", + "Settings:Identity": "Identity", + "Settings:Identity.User": "User", + "Settings:Identity.Lockout": "Lockout", + "Settings:Identity.SignIn": "SignIn", + "Settings:Identity.Password": "Password", + "Settings:Identity.OrganizationUnit": "OrganizationUnit", + "Settings:Identity.Session": "Session", + "Settings:Identity.Link": "Link" } } \ No newline at end of file diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json index 2dfb6959b..1d4b0dacd 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Localization/zh-Hans.json @@ -116,6 +116,14 @@ "CurrentSession": "当前会话", "RevokeSession": "撤销会话", "SessionWillBeRevokedMessage": "选择的会话将被撤销,此操作使目标登录失效!", - "SuccessfullyRevoked": "撤销会话成功" + "SuccessfullyRevoked": "撤销会话成功", + "Settings:Identity": "身份认证", + "Settings:Identity.User": "用户配置", + "Settings:Identity.Lockout": "用户锁定", + "Settings:Identity.SignIn": "用户登录", + "Settings:Identity.Password": "密码配置", + "Settings:Identity.OrganizationUnit": "组织机构", + "Settings:Identity.Session": "会话配置", + "Settings:Identity.Link": "链接" } } \ No newline at end of file diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Settings/IdentitySettingDefinitionProvider.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Settings/IdentitySettingDefinitionProvider.cs index 3c764fd5d..5deb67d9e 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Settings/IdentitySettingDefinitionProvider.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/Settings/IdentitySettingDefinitionProvider.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Identity.Localization; +using Microsoft.Extensions.Localization; +using Volo.Abp; +using Volo.Abp.Identity.Localization; using Volo.Abp.Localization; using Volo.Abp.Settings; @@ -6,8 +8,20 @@ namespace LINGYUN.Abp.Identity.Settings; public class IdentitySettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "Identity"; + private const int GroupOrder = 10; + + protected IStringLocalizerFactory StringLocalizerFactory { get; } + + public IdentitySettingDefinitionProvider(IStringLocalizerFactory stringLocalizerFactory) + { + StringLocalizerFactory = stringLocalizerFactory; + } + public override void Define(ISettingDefinitionContext context) { + var stringLocalizer = StringLocalizerFactory.Create(); + context.Add( new SettingDefinition( name: IdentitySettingNames.User.SmsNewUserRegister, @@ -19,7 +33,11 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("User", L("Settings:Identity.User"), order: 1) + .WithOrder(0) + .WithValueType(ValueType.String), new SettingDefinition( name: IdentitySettingNames.User.SmsUserSignin, defaultValue: "", @@ -30,7 +48,11 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("User", L("Settings:Identity.User"), order: 1) + .WithOrder(1) + .WithValueType(ValueType.String), new SettingDefinition( name: IdentitySettingNames.User.SmsResetPassword, defaultValue: "", @@ -41,7 +63,11 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("User", L("Settings:Identity.User"), order: 1) + .WithOrder(2) + .WithValueType(ValueType.String), new SettingDefinition( name: IdentitySettingNames.User.SmsPhoneNumberConfirmed, defaultValue: "", @@ -52,7 +78,11 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("User", L("Settings:Identity.User"), order: 1) + .WithOrder(3) + .WithValueType(ValueType.String), new SettingDefinition( name: IdentitySettingNames.User.SmsRepetInterval, defaultValue: "5", @@ -63,7 +93,11 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("User", L("Settings:Identity.User"), order: 1) + .WithOrder(4) + .WithValueType(ValueType.Number), new SettingDefinition( name: IdentitySettingNames.Session.ConcurrentLoginStrategy, defaultValue: ConcurrentLoginStrategy.None.ToString(), @@ -74,7 +108,16 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("Session", L("Settings:Identity.Session"), order: 5) + .WithOrder(0) + .WithOptions([ + new NameValue(stringLocalizer["ConcurrentLoginStrategy:None"].Value, ConcurrentLoginStrategy.None.ToString()), + new NameValue(stringLocalizer["ConcurrentLoginStrategy:LogoutFromSameTypeDevicesLimit"].Value, ConcurrentLoginStrategy.LogoutFromSameTypeDevicesLimit.ToString()), + new NameValue(stringLocalizer["ConcurrentLoginStrategy:LogoutFromSameTypeDevices"].Value, ConcurrentLoginStrategy.LogoutFromSameTypeDevices.ToString()), + new NameValue(stringLocalizer["ConcurrentLoginStrategy:LogoutFromAllDevices"].Value, ConcurrentLoginStrategy.LogoutFromAllDevices.ToString()), + ]), new SettingDefinition( name: IdentitySettingNames.Session.LogoutFromSameTypeDevicesLimit, defaultValue: "1", @@ -85,7 +128,11 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider DefaultValueSettingValueProvider.ProviderName, ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, - TenantSettingValueProvider.ProviderName), + TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("Session", L("Settings:Identity.Session"), order: 5) + .WithOrder(1) + .WithValueType(ValueType.Number), new SettingDefinition( name: IdentitySettingNames.Link.UserLoginUri, @@ -98,6 +145,10 @@ public class IdentitySettingDefinitionProvider : SettingDefinitionProvider ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + .WithParent("Link", L("Settings:Identity.Link"), order: 7) + .WithOrder(0) + .WithValueType(ValueType.String) ); } diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN.Abp.Identity.Domain.csproj b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN.Abp.Identity.Domain.csproj index d420b343d..cc7a232d5 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN.Abp.Identity.Domain.csproj +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN.Abp.Identity.Domain.csproj @@ -18,6 +18,7 @@ + diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityGroupSettingDefinitionProvider.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityGroupSettingDefinitionProvider.cs new file mode 100644 index 000000000..cc1cbd211 --- /dev/null +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityGroupSettingDefinitionProvider.cs @@ -0,0 +1,247 @@ +using Volo.Abp.Identity.Localization; +using Volo.Abp.Identity.Settings; +using Volo.Abp.Localization; +using Volo.Abp.Settings; +using ValueType = Volo.Abp.Settings.ValueType; + +namespace LINGYUN.Abp.Identity; + +public class IdentityGroupSettingDefinitionProvider : SettingDefinitionProvider +{ + private const string GroupName = "Identity"; + private const int GroupOrder = 10; + + public override void Define(ISettingDefinitionContext context) + { + SetLockoutSettingGroup(context); + SetUserSettingGroup(context); + SetSignInSettingGroup(context); + SetPasswordSettingGroup(context); + SetOrganizationUnitSettingGroup(context); + } + + private static void SetLockoutSettingGroup(ISettingDefinitionContext context) + { + context.GetOrNull(IdentitySettingNames.Lockout.AllowedForNewUsers) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Lockout", L("Settings:Identity.Lockout"), order: 3) + ?.WithOrder(0) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Lockout.LockoutDuration) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Lockout", L("Settings:Identity.Lockout"), order: 3) + ?.WithOrder(1) + ?.WithValueType(ValueType.Number) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Lockout.MaxFailedAccessAttempts) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Lockout", L("Settings:Identity.Lockout"), order: 3) + ?.WithOrder(2) + ?.WithValueType(ValueType.Number) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + } + + private static void SetUserSettingGroup(ISettingDefinitionContext context) + { + context.GetOrNull(IdentitySettingNames.User.IsEmailUpdateEnabled) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("User", L("Settings:Identity.User"), order: 1) + ?.WithOrder(0) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.User.IsUserNameUpdateEnabled) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("User", L("Settings:Identity.User"), order: 1) + ?.WithOrder(1) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + } + + private static void SetSignInSettingGroup(ISettingDefinitionContext context) + { + context.GetOrNull(IdentitySettingNames.SignIn.RequireConfirmedEmail) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("SignIn", L("Settings:Identity.SignIn"), order: 2) + ?.WithOrder(0) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.SignIn.RequireEmailVerificationToRegister) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("SignIn", L("Settings:Identity.SignIn"), order: 2) + ?.WithOrder(1) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.SignIn.EnablePhoneNumberConfirmation) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("SignIn", L("Settings:Identity.SignIn"), order: 2) + ?.WithOrder(2) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("SignIn", L("Settings:Identity.SignIn"), order: 2) + ?.WithOrder(3) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + } + + private static void SetPasswordSettingGroup(ISettingDefinitionContext context) + { + context.GetOrNull(IdentitySettingNames.Password.RequireDigit) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(0) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.RequiredLength) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(1) + ?.WithValueType(ValueType.Number) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.RequiredUniqueChars) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(2) + ?.WithValueType(ValueType.Number) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.RequireLowercase) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(3) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.RequireUppercase) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(4) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.RequireNonAlphanumeric) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(5) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.ForceUsersToPeriodicallyChangePassword) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(6) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.PasswordChangePeriodDays) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(7) + ?.WithValueType(ValueType.Number) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.EnablePreventPasswordReuse) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(8) + ?.WithValueType(ValueType.Boolean) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + context.GetOrNull(IdentitySettingNames.Password.PreventPasswordReuseCount) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("Password", L("Settings:Identity.Password"), order: 4) + ?.WithOrder(9) + ?.WithValueType(ValueType.Number) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + } + + private static void SetOrganizationUnitSettingGroup(ISettingDefinitionContext context) + { + context.GetOrNull(IdentitySettingNames.OrganizationUnit.MaxUserMembershipCount) + ?.WithGroup(GroupName, L("Settings:Identity"), GroupOrder) + ?.WithParent("OrganizationUnit", L("Settings:Identity.OrganizationUnit"), order: 6) + ?.WithOrder(0) + ?.WithValueType(ValueType.Number) + ?.ReplaceProviders( + DefaultValueSettingValueProvider.ProviderName, + ConfigurationSettingValueProvider.ProviderName, + GlobalSettingValueProvider.ProviderName, + TenantSettingValueProvider.ProviderName); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } +} diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj index 1efc41797..531f1ff36 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN.Abp.MessageService.Domain.Shared.csproj @@ -24,6 +24,7 @@ + diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json index 7a13975df..32dc74af3 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/en.json @@ -28,6 +28,10 @@ "Notifications:DissolveGroup": "Dissolve group notification", "AddNewFriendBySearchId": "Add by account search", "WelcomeToApplicationFormUser": "User :{User} welcome to join us!", - "Messages:NewFriend": "I have added you as a friend, let's chat together!" + "Messages:NewFriend": "I have added you as a friend, let's chat together!", + "DisplayName:RecallExpirationTime": "Message revocation expiration time", + "Description:RecallExpirationTime": "Allow user to withdraw message time limit (minutes).", + "Settings:MessageService": "IM", + "Settings:MessageService.Messages": "Messages" } } \ No newline at end of file diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json index ba4233ca3..617fefb89 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json @@ -28,6 +28,10 @@ "Notifications:DissolveGroup": "群组解散通知", "AddNewFriendBySearchId": "通过账号搜索添加", "WelcomeToApplicationFormUser": "用户:{User} 欢迎您的加入!", - "Messages:NewFriend": "我已经添加您为好友,让我们一起聊天吧!" + "Messages:NewFriend": "我已经添加您为好友,让我们一起聊天吧!", + "DisplayName:RecallExpirationTime": "撤回消息过期时间", + "Description:RecallExpirationTime": "允许用户撤回消息时间限制(分).", + "Settings:MessageService": "即时通讯", + "Settings:MessageService.Messages": "消息设置" } } \ No newline at end of file diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Settings/MessageServiceSettingDefinitionProvider.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Settings/MessageServiceSettingDefinitionProvider.cs index 20295a38f..502a884cd 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Settings/MessageServiceSettingDefinitionProvider.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/Settings/MessageServiceSettingDefinitionProvider.cs @@ -6,6 +6,7 @@ namespace LINGYUN.Abp.MessageService.Settings; public class MessageServiceSettingDefinitionProvider : SettingDefinitionProvider { + private const string GroupName = "MessageService"; public override void Define(ISettingDefinitionContext context) { context.Add( @@ -21,10 +22,13 @@ public class MessageServiceSettingDefinitionProvider : SettingDefinitionProvider ConfigurationSettingValueProvider.ProviderName, GlobalSettingValueProvider.ProviderName, TenantSettingValueProvider.ProviderName) + .WithGroup(GroupName, L("Settings:MessageService")) + .WithParent("Messages", L("Settings:MessageService.Messages")) + .WithValueType(ValueType.Number) ); } - protected ILocalizableString L(string name) + protected LocalizableString L(string name) { return LocalizableString.Create(name); } diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Webhook/LINGYUN/Abp/Notifications/Webhook/WebhookNotificationPublishProvider.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Webhook/LINGYUN/Abp/Notifications/Webhook/WebhookNotificationPublishProvider.cs index 6aaa905b8..d25aaaf40 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Webhook/LINGYUN/Abp/Notifications/Webhook/WebhookNotificationPublishProvider.cs +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Webhook/LINGYUN/Abp/Notifications/Webhook/WebhookNotificationPublishProvider.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Features; @@ -29,32 +28,32 @@ public class WebhookNotificationPublishProvider : NotificationPublishProvider return base.CanPublishAsync(notification, cancellationToken); } - protected async override Task PublishAsync(NotificationInfo notification, IEnumerable identifiers, CancellationToken cancellationToken = default) + protected async override Task PublishAsync(NotificationPublishContext context, CancellationToken cancellationToken = default) { using var scope = ServiceScopeFactory.CreateScope(); foreach (var contributor in Options.Value.Contributors) { - var context = new WebhookNotificationContext(scope.ServiceProvider, notification); + var webhookNotificationContext = new WebhookNotificationContext(scope.ServiceProvider, context.Notification); - await contributor.ContributeAsync(context); + await contributor.ContributeAsync(webhookNotificationContext); - if (!context.HasResolved()) + if (!webhookNotificationContext.HasResolved()) { Logger.LogWarning("The Webhook notifies the contributor: {0} that the Webhook data for the given notification: {1} cannot be parsed. Skip it.", - contributor.Name, notification.Name); + contributor.Name, context.Notification.Name); continue; } else { await WebhookPublisher.PublishAsync( - context.Webhook.WebhookName, - context.Webhook.Data, - notification.TenantId, - context.Webhook.SendExactSameData, - context.Webhook.Headers); + webhookNotificationContext.Webhook.WebhookName, + webhookNotificationContext.Webhook.Data, + context.Notification.TenantId, + webhookNotificationContext.Webhook.SendExactSameData, + webhookNotificationContext.Webhook.Headers); - Logger.LogDebug("The webhook: {webhookName} with contributor: {name} has successfully published!", context.Webhook.WebhookName, Name); + Logger.LogDebug("The webhook: {webhookName} with contributor: {name} has successfully published!", webhookNotificationContext.Webhook.WebhookName, Name); } } } diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN.Abp.SettingManagement.Application.csproj b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN.Abp.SettingManagement.Application.csproj index 4c22b00c7..cdf9bb431 100644 --- a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN.Abp.SettingManagement.Application.csproj +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN.Abp.SettingManagement.Application.csproj @@ -27,6 +27,7 @@ + diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/AbpSettingManagementApplicationModule.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/AbpSettingManagementApplicationModule.cs index 948f517ef..04bcf3254 100644 --- a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/AbpSettingManagementApplicationModule.cs +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/AbpSettingManagementApplicationModule.cs @@ -3,10 +3,12 @@ using LINGYUN.Abp.Account.OAuth; using LINGYUN.Abp.Account.OAuth.Localization; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; +using Volo.Abp.Emailing; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.SettingManagement; using Volo.Abp.SettingManagement.Localization; +using Volo.Abp.Timing; using Volo.Abp.VirtualFileSystem; using VoloAbpSettingManagementApplicationContractsModule = Volo.Abp.SettingManagement.AbpSettingManagementApplicationContractsModule; @@ -18,6 +20,9 @@ namespace LINGYUN.Abp.SettingManagement; typeof(VoloAbpSettingManagementApplicationContractsModule), typeof(AbpAccountApplicationContractsModule), typeof(AbpAccountOAuthModule), + typeof(AbpEmailingModule), + typeof(AbpTimingModule), + typeof(AbpLocalizationModule), typeof(AbpDddApplicationModule) )] public class AbpSettingManagementApplicationModule : AbpModule diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/en.json b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/en.json index a9618ab5f..ed59b05e1 100644 --- a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/en.json +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/en.json @@ -35,6 +35,14 @@ "SettingProviders:T": "Tenant", "SettingProviders:U": "User", "BasicInfo": "Basic", - "Properties": "Properties" + "Properties": "Properties", + "Settings:DefaultGroup": "Default Group", + "Settings:DefaultSetting": "Default Setting", + "Settings:System": "System", + "Settings:System.Language": "Language", + "Settings:System.Timing": "Timing", + "Settings:Emailing": "Emailing", + "Settings:Emailing.Default": "Default", + "Settings:Emailing.Smtp": "Smtp" } } \ No newline at end of file diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/zh-Hans.json index 36a1374a3..b8d6541c7 100644 --- a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/Localization/Resources/zh-Hans.json @@ -35,6 +35,14 @@ "SettingProviders:T": "租户", "SettingProviders:U": "用户", "BasicInfo": "基本", - "Properties": "属性" + "Properties": "属性", + "Settings:DefaultGroup": "未分组设置", + "Settings:DefaultSetting": "默认设置", + "Settings:System": "系统设置", + "Settings:System.Language": "语言", + "Settings:System.Timing": "时区", + "Settings:Emailing": "邮件设置", + "Settings:Emailing.Default": "默认配置", + "Settings:Emailing.Smtp": "Smtp配置" } } \ No newline at end of file diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppService.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppService.cs new file mode 100644 index 000000000..6a49c330a --- /dev/null +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppService.cs @@ -0,0 +1,62 @@ +using Microsoft.AspNetCore.Authorization; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Features; +using Volo.Abp.MultiTenancy; +using Volo.Abp.SettingManagement; +using Volo.Abp.Settings; + +namespace LINGYUN.Abp.SettingManagement; + +[Authorize(AbpSettingManagementPermissions.Settings.Default)] +public class SettingV2AppService : SettingV2AppServiceBase, ISettingV2AppService +{ + public SettingV2AppService( + IDistributedEventBus eventBus, + ISettingManager settingManager, + ISettingDefinitionManager settingDefinitionManager) + : base(eventBus, settingManager, settingDefinitionManager) + { + } + + public async virtual Task GetAsync() + { + await CheckFeatureAsync(); + + var providerName = CurrentTenant.GetMultiTenancySide() == MultiTenancySides.Host + ? GlobalSettingValueProvider.ProviderName + : TenantSettingValueProvider.ProviderName; + var providerKey = CurrentTenant.GetMultiTenancySide() == MultiTenancySides.Host + ? null + : CurrentTenant.GetId().ToString(); + + return await GetAllForProviderAsync(providerName, providerKey); + } + + [Authorize(AbpSettingManagementPermissions.Settings.Manager)] + public async virtual Task SetAsync(UpdateSettingsDto input) + { + await CheckFeatureAsync(); + + var multiTenancySides = CurrentTenant.GetMultiTenancySide(); + foreach (var setting in input.Settings) + { + if (multiTenancySides == MultiTenancySides.Host) + { + await SettingManager.SetGlobalAsync(setting.Name, setting.Value); + } + else + { + await SettingManager.SetForTenantAsync(CurrentTenant.GetId(), setting.Name, setting.Value); + } + } + + CurrentUnitOfWork.OnCompleted(async () => + { + await EventBus.PublishAsync(new CurrentApplicationConfigurationCacheResetEventData()); + }); + + await CurrentUnitOfWork.SaveChangesAsync(); + } +} diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppServiceBase.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppServiceBase.cs new file mode 100644 index 000000000..3c7371af3 --- /dev/null +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingV2AppServiceBase.cs @@ -0,0 +1,165 @@ +using Microsoft.AspNetCore.Authorization; +using System; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Features; +using Volo.Abp.SettingManagement; +using Volo.Abp.SettingManagement.Localization; +using Volo.Abp.Settings; +using ValueType = Volo.Abp.Settings.ValueType; + +namespace LINGYUN.Abp.SettingManagement; + +public abstract class SettingV2AppServiceBase : ApplicationService +{ + protected IDistributedEventBus EventBus { get; } + protected ISettingManager SettingManager { get; } + protected ISettingDefinitionManager SettingDefinitionManager { get; } + + protected SettingV2AppServiceBase( + IDistributedEventBus eventBus, + ISettingManager settingManager, + ISettingDefinitionManager settingDefinitionManager) + { + EventBus = eventBus; + SettingManager = settingManager; + SettingDefinitionManager = settingDefinitionManager; + + LocalizationResource = typeof(AbpSettingManagementResource); + } + + protected async virtual Task GetAllForProviderAsync(string providerName, string providerKey) + { + var result = new SettingGroupResult(); + + var settingDefines = await SettingDefinitionManager.GetAllAsync(); + + + SettingGroupDto CreateSettingGroup(SettingResourceDefinition resource) + { + return resource != null + ? new SettingGroupDto(resource.Localize(StringLocalizerFactory).Value) + : new SettingGroupDto(L["Settings:DefaultGroup"]); + } + SettingDto CreateSetting(SettingGroupDto groupDto, SettingResourceDefinition resource) + { + var settingDisplayName = resource != null + ? resource.Localize(StringLocalizerFactory).Value + : L["Settings:DefaultSetting"]; + return groupDto.AddSetting(settingDisplayName, settingDisplayName); + } + async Task IsEnabledSettingResource(SettingResourceDefinition resource) + { + if (resource?.RequiredFeatures != null) + { + var checkFeatures = await FeatureChecker.IsEnabledAsync(resource.RequiredFeatures); + if (!checkFeatures.Any(x => x.Value)) + { + return false; + } + } + if (resource?.RequiredPermissions != null && + !await AuthorizationService.IsGrantedAnyAsync(resource.RequiredPermissions)) + { + return false; + } + return true; + } + async Task IsEnabledSetting(SettingDefinition setting) + { + if (setting.Providers.Count > 0 && !setting.Providers.Any(provider => provider == providerName)) + { + return false; + } + var requiredFeatures = setting.GetRequiredFeatures(); + if (requiredFeatures.Any()) + { + var checkFeatures = await FeatureChecker.IsEnabledAsync(requiredFeatures.ToArray()); + if (!checkFeatures.Any(x => x.Value)) + { + return false; + } + } + var requiredPermissions = setting.GetRequiredPermissions(); + if (requiredPermissions.Any() && + !await AuthorizationService.IsGrantedAnyAsync(requiredPermissions.ToArray())) + { + return false; + } + return true; + } + + foreach (var settingGroups in settingDefines.GroupBy(x => x.GetGroupOrNull()).OrderBy(x => x.Key?.Order ?? 9999)) + { + if (!await IsEnabledSettingResource(settingGroups.Key)) + { + continue; + } + var groupDto = CreateSettingGroup(settingGroups.Key); + foreach (var settings in settingGroups.GroupBy(x => x.GetParentOrNull()).OrderBy(x => x.Key?.Order ?? 9999)) + { + if (!await IsEnabledSettingResource(settings.Key)) + { + continue; + } + var settingDto = CreateSetting(groupDto, settings.Key); + + foreach (var setting in settings) + { + if (!await IsEnabledSetting(setting)) + { + continue; + } + var valueType = setting.GetValueTypeOrDefault(); + + var settingDetailsDto = settingDto.AddDetail( + await SettingDefinitionManager.GetAsync(setting.Name), + StringLocalizerFactory, + await SettingManager.GetOrNullAsync(setting.Name, providerName, providerKey), + valueType, + providerName); + + if (valueType == ValueType.Option) + { + var options = setting.GetOptions(); + settingDetailsDto.AddOptions(options.Select(option => new OptionDto(option.Name, option.Value))); + } + + var slot = setting.GetSlotOrNull(); + if (!slot.IsNullOrWhiteSpace()) + { + settingDetailsDto.WithSlot(slot); + } + + var requiredFeatures = setting.GetRequiredFeatures(); + if (requiredFeatures.Any()) + { + settingDetailsDto.RequiredFeature(requiredFeatures.ToArray()); + } + + var requiredPermissions = setting.GetRequiredPermissions(); + if (requiredPermissions.Any()) + { + settingDetailsDto.RequiredPermission(requiredPermissions.ToArray()); + } + } + + if (settingDto.Details.Count == 0) + { + groupDto.Settings.Remove(settingDto); + } + } + + result.AddGroup(groupDto); + } + + return result; + } + + protected async virtual Task CheckFeatureAsync() + { + await FeatureChecker.CheckEnabledAsync(SettingManagementFeatures.Enable); + } +} diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/UserSettingV2AppService.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/UserSettingV2AppService.cs new file mode 100644 index 000000000..33763342d --- /dev/null +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/UserSettingV2AppService.cs @@ -0,0 +1,38 @@ +using Microsoft.AspNetCore.Authorization; +using System.Threading.Tasks; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.MultiTenancy; +using Volo.Abp.SettingManagement; +using Volo.Abp.Settings; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.SettingManagement; + +[Authorize] +public class UserSettingV2AppService : SettingV2AppServiceBase, IUserSettingV2AppService +{ + public UserSettingV2AppService( + IDistributedEventBus eventBus, + ISettingManager settingManager, + ISettingDefinitionManager settingDefinitionManager) + : base(eventBus, settingManager, settingDefinitionManager) + { + } + + public async virtual Task GetAsync() + { + await CheckFeatureAsync(); + + return await GetAllForProviderAsync(UserSettingValueProvider.ProviderName, CurrentUser.GetId().ToString()); + } + + public async virtual Task SetAsync(UpdateSettingsDto input) + { + await CheckFeatureAsync(); + + foreach (var setting in input.Settings) + { + await SettingManager.SetForCurrentUserAsync(setting.Name, setting.Value); + } + } +} diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingController.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingController.cs index 09064a146..151109253 100644 --- a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingController.cs +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingController.cs @@ -1,59 +1,59 @@ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.AspNetCore.Mvc; - -namespace LINGYUN.Abp.SettingManagement; - -[RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)] -[Area("SettingManagement")] -[Route("api/setting-management/settings")] -public class SettingController : AbpControllerBase, ISettingAppService, ISettingTestAppService -{ - private readonly ISettingAppService _settingAppService; - private readonly ISettingTestAppService _settingTestAppService; - public SettingController( - ISettingAppService settingAppService, - ISettingTestAppService settingTestAppService) - { +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.SettingManagement; + +[RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)] +[Area("SettingManagement")] +[Route("api/setting-management/settings")] +public class SettingController : AbpControllerBase, ISettingAppService, ISettingTestAppService +{ + private readonly ISettingAppService _settingAppService; + private readonly ISettingTestAppService _settingTestAppService; + public SettingController( + ISettingAppService settingAppService, + ISettingTestAppService settingTestAppService) + { _settingAppService = settingAppService; _settingTestAppService = settingTestAppService; - } - - [HttpPut] - [Route("change-current-tenant")] - public async virtual Task SetCurrentTenantAsync(UpdateSettingsDto input) - { - await _settingAppService.SetCurrentTenantAsync(input); - } - - [HttpPut] - [Route("change-global")] - public async virtual Task SetGlobalAsync(UpdateSettingsDto input) - { - await _settingAppService.SetGlobalAsync(input); - } - - [HttpGet] - [Route("by-global")] - public async virtual Task GetAllForGlobalAsync() - { - return await _settingAppService.GetAllForGlobalAsync(); - } - - [HttpGet] - [Route("by-current-tenant")] - public async virtual Task GetAllForCurrentTenantAsync() - { - return await _settingAppService.GetAllForCurrentTenantAsync(); - } - - [HttpPost] - [Authorize] - [Route("send-test-email")] + } + + [HttpPut] + [Route("change-current-tenant")] + public async virtual Task SetCurrentTenantAsync(UpdateSettingsDto input) + { + await _settingAppService.SetCurrentTenantAsync(input); + } + + [HttpPut] + [Route("change-global")] + public async virtual Task SetGlobalAsync(UpdateSettingsDto input) + { + await _settingAppService.SetGlobalAsync(input); + } + + [HttpGet] + [Route("by-global")] + public async virtual Task GetAllForGlobalAsync() + { + return await _settingAppService.GetAllForGlobalAsync(); + } + + [HttpGet] + [Route("by-current-tenant")] + public async virtual Task GetAllForCurrentTenantAsync() + { + return await _settingAppService.GetAllForCurrentTenantAsync(); + } + + [HttpPost] + [Authorize] + [Route("send-test-email")] public async virtual Task SendTestEmailAsync(SendTestEmailInput input) { await _settingTestAppService.SendTestEmailAsync(input); - } -} + } +} diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingV2Controller.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingV2Controller.cs new file mode 100644 index 000000000..b35bbc8cd --- /dev/null +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/SettingV2Controller.cs @@ -0,0 +1,26 @@ +using Asp.Versioning; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.SettingManagement; + +[RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)] +[ApiVersion("2")] +[Area("SettingManagement")] +[Route("api/v{version}/setting-management/settings")] +public class SettingV2Controller(ISettingV2AppService _service) : AbpControllerBase, ISettingV2AppService +{ + [HttpGet] + public virtual Task GetAsync() + { + return _service.GetAsync(); + } + + [HttpPut] + public virtual Task SetAsync(UpdateSettingsDto input) + { + return _service.SetAsync(input); + } +} diff --git a/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/UserSettingV2Controller.cs b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/UserSettingV2Controller.cs new file mode 100644 index 000000000..788bfc1c0 --- /dev/null +++ b/aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.HttpApi/LINGYUN/Abp/SettingManagement/UserSettingV2Controller.cs @@ -0,0 +1,26 @@ +using Asp.Versioning; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.SettingManagement; + +[RemoteService(Name = AbpSettingManagementRemoteServiceConsts.RemoteServiceName)] +[ApiVersion("2")] +[Area("SettingManagement")] +[Route("api/v{version}/setting-management/my-settings")] +public class UserSettingV2Controller(IUserSettingV2AppService _service) : AbpControllerBase, IUserSettingV2AppService +{ + [HttpGet] + public virtual Task GetAsync() + { + return _service.GetAsync(); + } + + [HttpPut] + public virtual Task SetAsync(UpdateSettingsDto input) + { + return _service.SetAsync(input); + } +}