Allow user identity password and lockout configuration to be customized. Included additional environment information in System Info.

This commit is contained in:
Shaun Walker
2022-03-04 10:41:45 -05:00
parent 1cdc80e09b
commit 5adecc307f
12 changed files with 445 additions and 150 deletions

View File

@ -9,16 +9,34 @@ namespace Oqtane.Services
public interface ISystemService
{
/// <summary>
/// returns a key-value directory with the current system information (os-version, clr-version, etc.)
/// returns a key-value directory with the current system configuration information
/// </summary>
/// <returns></returns>
Task<Dictionary<string, string>> GetSystemInfoAsync();
Task<Dictionary<string, object>> GetSystemInfoAsync();
/// <summary>
/// returns a key-value directory with the current system information - "environment" or "configuration"
/// </summary>
/// <returns></returns>
Task<Dictionary<string, object>> GetSystemInfoAsync(string type);
/// <summary>
/// returns a config value
/// </summary>
/// <returns></returns>
Task<object> GetSystemInfoAsync(string settingKey, object defaultValue);
/// <summary>
/// Updates system information
/// </summary>
/// <param name="settings"></param>
/// <returns></returns>
Task UpdateSystemInfoAsync(Dictionary<string, string> settings);
Task UpdateSystemInfoAsync(Dictionary<string, object> settings);
/// <summary>
/// updates a config value
/// </summary>
/// <returns></returns>
Task UpdateSystemInfoAsync(string settingKey, object settingValue);
}
}

View File

@ -18,14 +18,28 @@ namespace Oqtane.Services
private string Apiurl => CreateApiUrl("System", _siteState.Alias);
public async Task<Dictionary<string, string>> GetSystemInfoAsync()
public async Task<Dictionary<string, object>> GetSystemInfoAsync()
{
return await GetJsonAsync<Dictionary<string, string>>(Apiurl);
return await GetSystemInfoAsync("configuration");
}
public async Task UpdateSystemInfoAsync(Dictionary<string, string> settings)
public async Task<Dictionary<string, object>> GetSystemInfoAsync(string type)
{
return await GetJsonAsync<Dictionary<string, object>>($"{Apiurl}?type={type}");
}
public async Task<object> GetSystemInfoAsync(string settingKey, object defaultValue)
{
return await GetJsonAsync<object>($"{Apiurl}/{settingKey}/{defaultValue}");
}
public async Task UpdateSystemInfoAsync(Dictionary<string, object> settings)
{
await PostJsonAsync(Apiurl, settings);
}
public async Task UpdateSystemInfoAsync(string settingKey, object settingValue)
{
await PutJsonAsync($"{Apiurl}/{settingKey}/{settingValue}", "");
}
}
}