|
|
|
@ -63,7 +63,9 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|
|
|
{ |
|
|
|
//TODO: Optimize & cache..?
|
|
|
|
|
|
|
|
return new ApplicationConfigurationDto |
|
|
|
Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetAsync()..."); |
|
|
|
|
|
|
|
var result = new ApplicationConfigurationDto |
|
|
|
{ |
|
|
|
Auth = await GetAuthConfigAsync(), |
|
|
|
Features = await GetFeaturesConfigAsync(), |
|
|
|
@ -74,6 +76,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|
|
|
CurrentTenant = GetCurrentTenant(), |
|
|
|
ObjectExtensions = _cachedObjectExtensionsDtoService.Get() |
|
|
|
}; |
|
|
|
|
|
|
|
Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetAsync()."); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual CurrentTenantDto GetCurrentTenant() |
|
|
|
@ -107,35 +113,25 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|
|
|
|
|
|
|
protected virtual async Task<ApplicationAuthConfigurationDto> GetAuthConfigAsync() |
|
|
|
{ |
|
|
|
Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetAuthConfigAsync()"); |
|
|
|
|
|
|
|
var authConfig = new ApplicationAuthConfigurationDto(); |
|
|
|
|
|
|
|
var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync(); |
|
|
|
|
|
|
|
Logger.LogDebug($"GetPoliciesNamesAsync returns {policyNames.Count} items."); |
|
|
|
|
|
|
|
foreach (var policyName in policyNames) |
|
|
|
{ |
|
|
|
authConfig.Policies[policyName] = true; |
|
|
|
|
|
|
|
Logger.LogDebug($"_authorizationService.IsGrantedAsync? {policyName}"); |
|
|
|
|
|
|
|
if (await _authorizationService.IsGrantedAsync(policyName)) |
|
|
|
{ |
|
|
|
authConfig.GrantedPolicies[policyName] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetAuthConfigAsync()"); |
|
|
|
|
|
|
|
return authConfig; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task<ApplicationLocalizationConfigurationDto> GetLocalizationConfigAsync() |
|
|
|
{ |
|
|
|
Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetLocalizationConfigAsync()"); |
|
|
|
|
|
|
|
var localizationConfig = new ApplicationLocalizationConfigurationDto(); |
|
|
|
|
|
|
|
localizationConfig.Languages.AddRange(await _languageProvider.GetLanguagesAsync()); |
|
|
|
@ -165,8 +161,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetLocalizationConfigAsync()"); |
|
|
|
|
|
|
|
return localizationConfig; |
|
|
|
} |
|
|
|
|
|
|
|
@ -197,8 +191,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|
|
|
|
|
|
|
private async Task<ApplicationSettingConfigurationDto> GetSettingConfigAsync() |
|
|
|
{ |
|
|
|
Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetSettingConfigAsync()"); |
|
|
|
|
|
|
|
var result = new ApplicationSettingConfigurationDto |
|
|
|
{ |
|
|
|
Values = new Dictionary<string, string>() |
|
|
|
@ -214,15 +206,11 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|
|
|
result.Values[settingDefinition.Name] = await _settingProvider.GetOrNullAsync(settingDefinition.Name); |
|
|
|
} |
|
|
|
|
|
|
|
Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetSettingConfigAsync()"); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task<ApplicationFeatureConfigurationDto> GetFeaturesConfigAsync() |
|
|
|
{ |
|
|
|
Logger.LogDebug("Executing AbpApplicationConfigurationAppService.GetFeaturesConfigAsync()"); |
|
|
|
|
|
|
|
var result = new ApplicationFeatureConfigurationDto(); |
|
|
|
|
|
|
|
foreach (var featureDefinition in _featureDefinitionManager.GetAll()) |
|
|
|
@ -235,8 +223,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations |
|
|
|
result.Values[featureDefinition.Name] = await FeatureChecker.GetOrNullAsync(featureDefinition.Name); |
|
|
|
} |
|
|
|
|
|
|
|
Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetFeaturesConfigAsync()"); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|