diff --git a/src/App/Pages/VaultFilterViewModel.cs b/src/App/Pages/VaultFilterViewModel.cs index 0a801a97c..24ea7f042 100644 --- a/src/App/Pages/VaultFilterViewModel.cs +++ b/src/App/Pages/VaultFilterViewModel.cs @@ -19,7 +19,7 @@ namespace Bit.App.Pages protected abstract ILogger logger { get; } protected bool _showVaultFilter; - protected bool _hideMyVaultFilterOption; + protected bool _personalOwnershipPolicyApplies; protected string _vaultFilterSelection; protected List _organizations; @@ -64,15 +64,21 @@ namespace Bit.App.Pages protected async Task InitVaultFilterAsync() { _organizations = await organizationService.GetAllAsync(); - ShowVaultFilter = await policyService.ShouldShowVaultFilterAsync(); - if (ShowVaultFilter) + if (_organizations?.Any() ?? false) { - _hideMyVaultFilterOption = await policyService.PolicyAppliesToUser(PolicyType.PersonalOwnership); - if (_vaultFilterSelection == null) + _personalOwnershipPolicyApplies = await policyService.PolicyAppliesToUser(PolicyType.PersonalOwnership); + var singleOrgPolicyApplies = await policyService.PolicyAppliesToUser(PolicyType.OnlyOrg); + if (_personalOwnershipPolicyApplies && singleOrgPolicyApplies) { - _vaultFilterSelection = AppResources.AllVaults; + VaultFilterDescription = _organizations.First().Name; + } + else if (_vaultFilterSelection == null) + { + VaultFilterDescription = AppResources.AllVaults; } } + await Task.Delay(100); + ShowVaultFilter = await policyService.ShouldShowVaultFilterAsync(); } protected async Task> GetAllCiphersAsync() @@ -93,7 +99,7 @@ namespace Bit.App.Pages protected async Task VaultFilterOptionsAsync() { var options = new List { AppResources.AllVaults }; - if (!_hideMyVaultFilterOption) + if (!_personalOwnershipPolicyApplies) { options.Add(AppResources.MyVault); }