diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs
index db0ea4f977..bb23757de5 100644
--- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs
+++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs
@@ -19,7 +19,7 @@ namespace Volo.Abp.Authorization.Permissions
public PermissionDefinition Parent { get; private set; }
///
- /// A list of allowed providers to get value of this permission.
+ /// A list of allowed providers to get/set value of this permission.
/// An empty list indicates that all providers are allowed.
///
public List Providers { get; }
diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/ISettingManager.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/ISettingManager.cs
index 9c794a2c9b..bd0b5c7d20 100644
--- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/ISettingManager.cs
+++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/ISettingManager.cs
@@ -6,12 +6,8 @@ namespace Volo.Abp.Settings
{
public interface ISettingManager
{
- Task GetOrNullAsync([NotNull]string name);
-
Task GetOrNullAsync([NotNull]string name, [NotNull] string providerName, [CanBeNull] string providerKey, bool fallback = true);
- Task> GetAllAsync();
-
Task> GetAllAsync([NotNull] string providerName, [CanBeNull] string providerKey, bool fallback = true);
Task SetAsync([NotNull] string name, [CanBeNull] string value, [NotNull] string providerName, [CanBeNull] string providerKey, bool forceToSet = false);
diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingDefinition.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingDefinition.cs
index 1563de3291..9f02389248 100644
--- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingDefinition.cs
+++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingDefinition.cs
@@ -37,7 +37,7 @@ namespace Volo.Abp.Settings
public bool IsVisibleToClients { get; set; }
///
- /// A list of allowed providers to get value of this permission.
+ /// A list of allowed providers to get/set value of this setting.
/// An empty list indicates that all providers are allowed.
///
public List Providers { get; }
diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManager.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManager.cs
index 33087bab77..fffa1021a9 100644
--- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManager.cs
+++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManager.cs
@@ -33,14 +33,7 @@ namespace Volo.Abp.Settings
true
);
}
-
- public virtual Task GetOrNullAsync(string name)
- {
- Check.NotNull(name, nameof(name));
-
- return GetOrNullInternalAsync(name, null, null);
- }
-
+
public virtual Task GetOrNullAsync(string name, string providerName, string providerKey, bool fallback = true)
{
Check.NotNull(name, nameof(name));
@@ -49,31 +42,6 @@ namespace Volo.Abp.Settings
return GetOrNullInternalAsync(name, providerName, providerKey, fallback);
}
- public virtual async Task> GetAllAsync()
- {
- var settingValues = new Dictionary();
- var settingDefinitions = SettingDefinitionManager.GetAll();
-
- foreach (var provider in Providers.Value)
- {
- foreach (var setting in settingDefinitions)
- {
- var value = await provider.GetOrNullAsync(setting, null);
- if (value != null)
- {
- if (setting.IsEncrypted)
- {
- value = SettingEncryptionService.Decrypt(setting, value);
- }
-
- settingValues[setting.Name] = new SettingValue(setting.Name, value);
- }
- }
- }
-
- return settingValues.Values.ToList();
- }
-
public virtual async Task> GetAllAsync(string providerName, string providerKey, bool fallback = true)
{
Check.NotNull(providerName, nameof(providerName));
diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerExtensions.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerExtensions.cs
deleted file mode 100644
index d9f4f3950b..0000000000
--- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerExtensions.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using JetBrains.Annotations;
-
-namespace Volo.Abp.Settings
-{
- public static class SettingManagerExtensions
- {
- public static async Task IsTrueAsync([NotNull] this ISettingManager settingManager, [NotNull] string name)
- {
- Check.NotNull(settingManager, nameof(settingManager));
- Check.NotNull(name, nameof(name));
-
- return string.Equals(
- await settingManager.GetOrNullAsync(name),
- "true",
- StringComparison.OrdinalIgnoreCase
- );
- }
-
- public static async Task GetAsync([NotNull] this ISettingManager settingManager, [NotNull] string name, T defaultValue = default)
- where T : struct
- {
- Check.NotNull(settingManager, nameof(settingManager));
- Check.NotNull(name, nameof(name));
-
- var value = await settingManager.GetOrNullAsync(name);
- return value?.To() ?? defaultValue;
- }
- }
-}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerSyncExtensions.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerSyncExtensions.cs
deleted file mode 100644
index e5d31bd16c..0000000000
--- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingManagerSyncExtensions.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Collections.Generic;
-using JetBrains.Annotations;
-using Volo.Abp.Threading;
-
-namespace Volo.Abp.Settings
-{
- public static class SettingManagerSyncExtensions
- {
- public static string GetOrNull([NotNull] this ISettingManager settingManager, [NotNull] string name)
- {
- Check.NotNull(settingManager, nameof(settingManager));
-
- return AsyncHelper.RunSync(() => settingManager.GetOrNullAsync(name));
- }
-
- public static List GetAll([NotNull] this ISettingManager settingManager)
- {
- Check.NotNull(settingManager, nameof(settingManager));
-
- return AsyncHelper.RunSync(settingManager.GetAllAsync);
- }
-
- public static T Get([NotNull] this ISettingManager settingManager, [NotNull] string name, T defaultValue = default)
- where T : struct
- {
- return AsyncHelper.RunSync(() => settingManager.GetAsync(name, defaultValue));
- }
-
- public static bool IsTrue([NotNull] this ISettingManager settingManager, [NotNull] string name)
- {
- return AsyncHelper.RunSync(() => settingManager.IsTrueAsync(name));
- }
- }
-}
diff --git a/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingManager_Tests.cs b/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingManager_Tests.cs
deleted file mode 100644
index 82231b8318..0000000000
--- a/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingManager_Tests.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Threading.Tasks;
-using Shouldly;
-using Xunit;
-
-namespace Volo.Abp.Settings
-{
- public class SettingManager_Tests : AbpIntegratedTest
- {
- private readonly ISettingManager _settingManager;
-
- public SettingManager_Tests()
- {
- _settingManager = GetRequiredService();
- }
-
- [Fact]
- public async Task Should_Get_Null_If_No_Value_Provided_And_No_Default_Value()
- {
- (await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue))
- .ShouldBeNull();
- }
-
- [Fact]
- public async Task Should_Get_Default_Value_If_No_Value_Provided_And_There_Is_A_Default_Value()
- {
- (await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue))
- .ShouldBe("default-value");
- }
-
- [Theory]
- [InlineData(null)]
- [InlineData("")]
- [InlineData("abc")]
- [InlineData("This is a relatively long text... This is a relatively long text... This is a relatively long text... ")]
- public async Task Should_Set_And_Get_Encrypted_Values(string plainValue)
- {
- (await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingEncrypted))
- .ShouldBeNull();
-
- await _settingManager.SetAsync(
- TestSettingNames.TestSettingEncrypted,
- plainValue,
- TestSettingValueProvider.ProviderName,
- null
- );
-
- (await _settingManager.GetOrNullAsync(TestSettingNames.TestSettingEncrypted))
- .ShouldBe(plainValue);
- }
-
- //TODO: Needs more tests with more advanced scenarios.
- }
-}