diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/Default.cshtml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/Default.cshtml index 33419549f0..515d4cc7dc 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/Default.cshtml +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/Default.cshtml @@ -1,14 +1,17 @@ @using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.Components.TenantSwitch @model TenantSwitchViewComponent.TenantSwitchViewModel - \ No newline at end of file +@if (!Model.CurrentUser.IsAuthenticated) +{ + +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/TenantSwitchViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/TenantSwitchViewComponent.cs index 739dc71b5b..bfcaebed0e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/TenantSwitchViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Components/TenantSwitch/TenantSwitchViewComponent.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.MultiTenancy; +using Volo.Abp.Users; namespace Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.Components.TenantSwitch { @@ -12,18 +13,25 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.Components.TenantSwitch public const int Order = -1_000_000; protected ITenantStore TenantStore { get; } - protected ICurrentTenant CurrentTenant { get; } + protected ICurrentUser CurrentUser { get; } - public TenantSwitchViewComponent(ITenantStore tenantStore, ICurrentTenant currentTenant) + public TenantSwitchViewComponent( + ITenantStore tenantStore, + ICurrentTenant currentTenant, + ICurrentUser currentUser) { TenantStore = tenantStore; CurrentTenant = currentTenant; + CurrentUser = currentUser; } public async Task InvokeAsync() { - var model = new TenantSwitchViewModel(); + var model = new TenantSwitchViewModel + { + CurrentUser = CurrentUser + }; if (CurrentTenant.Id.HasValue) { @@ -36,6 +44,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.Components.TenantSwitch public class TenantSwitchViewModel { public TenantInfo Tenant { get; set; } + + public ICurrentUser CurrentUser { get; set; } } } }