|
|
|
|
@ -4,10 +4,12 @@ using Microsoft.Extensions.Localization;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Volo.Abp.Application.Services;
|
|
|
|
|
using Volo.Abp.Authorization;
|
|
|
|
|
using Volo.Abp.Localization;
|
|
|
|
|
using Volo.Abp.Settings;
|
|
|
|
|
using Volo.Abp.Users;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
|
|
|
|
|
@ -19,18 +21,24 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
|
|
|
|
|
private readonly IAbpAuthorizationPolicyProvider _abpAuthorizationPolicyProvider;
|
|
|
|
|
private readonly IAuthorizationService _authorizationService;
|
|
|
|
|
private readonly ICurrentUser _currentUser;
|
|
|
|
|
private readonly ISettingProvider _settingProvider;
|
|
|
|
|
private readonly ISettingDefinitionManager _settingDefinitionManager;
|
|
|
|
|
|
|
|
|
|
public AbpApplicationConfigurationAppService(
|
|
|
|
|
IOptions<AbpLocalizationOptions> localizationOptions,
|
|
|
|
|
IServiceProvider serviceProvider,
|
|
|
|
|
IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider,
|
|
|
|
|
IAuthorizationService authorizationService,
|
|
|
|
|
ICurrentUser currentUser)
|
|
|
|
|
ICurrentUser currentUser,
|
|
|
|
|
ISettingProvider settingProvider,
|
|
|
|
|
SettingDefinitionManager settingDefinitionManager)
|
|
|
|
|
{
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
_abpAuthorizationPolicyProvider = abpAuthorizationPolicyProvider;
|
|
|
|
|
_authorizationService = authorizationService;
|
|
|
|
|
_currentUser = currentUser;
|
|
|
|
|
_settingProvider = settingProvider;
|
|
|
|
|
_settingDefinitionManager = settingDefinitionManager;
|
|
|
|
|
_localizationOptions = localizationOptions.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -40,9 +48,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
|
|
|
|
|
|
|
|
|
|
return new ApplicationConfigurationDto
|
|
|
|
|
{
|
|
|
|
|
Auth = await GetAuthConfig(),
|
|
|
|
|
Auth = await GetAuthConfigAsync(),
|
|
|
|
|
Localization = GetLocalizationConfig(),
|
|
|
|
|
CurrentUser = GetCurrentUser()
|
|
|
|
|
CurrentUser = GetCurrentUser(),
|
|
|
|
|
Setting = await GetSettingConfigAsync()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -57,7 +66,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual async Task<ApplicationAuthConfigurationDto> GetAuthConfig()
|
|
|
|
|
protected virtual async Task<ApplicationAuthConfigurationDto> GetAuthConfigAsync()
|
|
|
|
|
{
|
|
|
|
|
var authConfig = new ApplicationAuthConfigurationDto();
|
|
|
|
|
|
|
|
|
|
@ -97,5 +106,25 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
|
|
|
|
|
|
|
|
|
|
return localizationConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task<ApplicationSettingConfigurationDto> GetSettingConfigAsync()
|
|
|
|
|
{
|
|
|
|
|
var result = new ApplicationSettingConfigurationDto
|
|
|
|
|
{
|
|
|
|
|
Values = new Dictionary<string, string>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (var settingDefinition in _settingDefinitionManager.GetAll())
|
|
|
|
|
{
|
|
|
|
|
if (!settingDefinition.IsVisibleToClients)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Values[settingDefinition.Name] = await _settingProvider.GetOrNullAsync(settingDefinition.Name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|