Merge pull request #2986 from abpframework/akin/Updated-abpAppConfController-for-return-value-about-multiTenancy

added multi tenancy info and current tenant dto class
pull/3021/head
Halil İbrahim Kalkan 6 years ago committed by GitHub
commit 6a9490fa49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
using System;
using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
{
@ -14,5 +15,9 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
public CurrentUserDto CurrentUser { get; set; }
public ApplicationFeatureConfigurationDto Features { get; set; }
public MultiTenancyInfoDto MultiTenancy { get; set; }
public CurrentTenantDto CurrentTenant { get; set; }
}
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volo.Abp.AspNetCore.Mvc.MultiTenancy
{
public class CurrentTenantDto
{
public Guid? Id { get; set; }
public string Name { get; set; }
public bool IsAvailable { get; set; }
}
}

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volo.Abp.AspNetCore.Mvc.MultiTenancy
{
public class MultiTenancyInfoDto
{
public bool IsEnabled { get; set; }
}
}

@ -8,9 +8,11 @@ using System.Globalization;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Volo.Abp.Application.Services;
using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
using Volo.Abp.Authorization;
using Volo.Abp.Features;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Settings;
using Volo.Abp.Users;
@ -19,6 +21,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApplicationConfigurationAppService
{
private readonly AbpLocalizationOptions _localizationOptions;
private readonly AbpMultiTenancyOptions _multiTenancyOptions;
private readonly IServiceProvider _serviceProvider;
private readonly IAbpAuthorizationPolicyProvider _abpAuthorizationPolicyProvider;
private readonly IAuthorizationService _authorizationService;
@ -30,6 +33,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
public AbpApplicationConfigurationAppService(
IOptions<AbpLocalizationOptions> localizationOptions,
IOptions<AbpMultiTenancyOptions> multiTenancyOptions,
IServiceProvider serviceProvider,
IAbpAuthorizationPolicyProvider abpAuthorizationPolicyProvider,
IAuthorizationService authorizationService,
@ -48,6 +52,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
_featureDefinitionManager = featureDefinitionManager;
_languageProvider = languageProvider;
_localizationOptions = localizationOptions.Value;
_multiTenancyOptions = multiTenancyOptions.Value;
}
public virtual async Task<ApplicationConfigurationDto> GetAsync()
@ -60,11 +65,31 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations
Features = await GetFeaturesConfigAsync(),
Localization = await GetLocalizationConfigAsync(),
CurrentUser = GetCurrentUser(),
Setting = await GetSettingConfigAsync()
Setting = await GetSettingConfigAsync(),
MultiTenancy = GetMultiTenancy(),
CurrentTenant = GetCurrentTenant()
};
}
protected virtual CurrentTenantDto GetCurrentTenant()
{
return new CurrentTenantDto()
{
Id = CurrentTenant.Id,
Name = CurrentTenant.Name,
isAvailable = CurrentTenant.IsAvailable
};
}
protected virtual MultiTenancyInfoDto GetMultiTenancy()
{
return new MultiTenancyInfoDto
{
IsEnabled = _multiTenancyOptions.IsEnabled
};
}
protected virtual CurrentUserDto GetCurrentUser()
{
return new CurrentUserDto

Loading…
Cancel
Save