diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index 20298701d41..8211f8eeb69 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -1967,5 +1967,11 @@ }, "ssoKeyConnectorError": { "message": "Key Connector error: make sure Key Connector is available and working correctly." + }, + "organizationIsDisabled": { + "message": "Organization is disabled." + }, + "disabledOrganizationFilterError" : { + "message" : "Items in disabled Organizations cannot be accessed. Contact your Organization owner for assistance." } } diff --git a/apps/browser/src/popup/vault/vault-select.component.html b/apps/browser/src/popup/vault/vault-select.component.html index 813fbccf148..69a526c8961 100644 --- a/apps/browser/src/popup/vault/vault-select.component.html +++ b/apps/browser/src/popup/vault/vault-select.component.html @@ -59,6 +59,12 @@ aria-hidden="true" >  {{ organization.name | ellipsis: 21:true }} + diff --git a/apps/browser/src/popup/vault/vault-select.component.ts b/apps/browser/src/popup/vault/vault-select.component.ts index e653cf4f492..4ed1dead32c 100644 --- a/apps/browser/src/popup/vault/vault-select.component.ts +++ b/apps/browser/src/popup/vault/vault-select.component.ts @@ -17,6 +17,7 @@ import { merge } from "rxjs"; import { VaultFilter } from "@bitwarden/angular/modules/vault-filter/models/vault-filter.model"; import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service"; import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; +import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { Organization } from "@bitwarden/common/models/domain/organization"; import { VaultFilterService } from "../../services/vaultFilter.service"; @@ -82,7 +83,8 @@ export class VaultSelectComponent implements OnInit { private ngZone: NgZone, private broadcasterService: BroadcasterService, private overlay: Overlay, - private viewContainerRef: ViewContainerRef + private viewContainerRef: ViewContainerRef, + private platformUtilsService: PlatformUtilsService ) {} async ngOnInit() { @@ -171,10 +173,18 @@ export class VaultSelectComponent implements OnInit { } selectOrganization(organization: Organization) { - this.vaultFilterDisplay = organization.name; - this.vaultFilterService.setVaultFilter(organization.id); - this.onVaultSelectionChanged.emit(); - this.close(); + if (!organization.enabled) { + this.platformUtilsService.showToast( + "error", + null, + this.i18nService.t("disabledOrganizationFilterError") + ); + } else { + this.vaultFilterDisplay = organization.name; + this.vaultFilterService.setVaultFilter(organization.id); + this.onVaultSelectionChanged.emit(); + this.close(); + } } selectAllVaults() { this.vaultFilterDisplay = this.i18nService.t(this.vaultFilterService.allVaults); diff --git a/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.html b/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.html index 686e29b4f35..7a8071e5427 100644 --- a/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.html +++ b/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.html @@ -92,6 +92,12 @@ >  {{ organization.name }} + diff --git a/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.ts b/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.ts index 6131cf739d2..f52d4bef6cb 100644 --- a/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.ts +++ b/apps/desktop/src/app/modules/vault-filter/components/organization-filter.component.ts @@ -2,6 +2,9 @@ import { Component } from "@angular/core"; import { OrganizationFilterComponent as BaseOrganizationFilterComponent } from "@bitwarden/angular/modules/vault-filter/components/organization-filter.component"; import { DisplayMode } from "@bitwarden/angular/modules/vault-filter/models/display-mode"; +import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; +import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; +import { Organization } from "@bitwarden/common/models/domain/organization"; @Component({ selector: "app-organization-filter", @@ -16,4 +19,24 @@ export class OrganizationFilterComponent extends BaseOrganizationFilterComponent hiddenDisplayModes.indexOf(this.displayMode) === -1 ); } + + constructor( + private i18nService: I18nService, + private platformUtilsService: PlatformUtilsService + ) { + super(); + } + + async applyOrganizationFilter(organization: Organization) { + if (organization.enabled) { + //proceed with default behaviour for enabled organizations + super.applyOrganizationFilter(organization); + } else { + this.platformUtilsService.showToast( + "error", + null, + this.i18nService.t("disabledOrganizationFilterError") + ); + } + } } diff --git a/apps/desktop/src/locales/en/messages.json b/apps/desktop/src/locales/en/messages.json index 64c1b443d48..7d12b136e64 100644 --- a/apps/desktop/src/locales/en/messages.json +++ b/apps/desktop/src/locales/en/messages.json @@ -1964,6 +1964,12 @@ "apiKey": { "message": "API Key" }, + "organizationIsDisabled": { + "message": "Organization is disabled." + }, + "disabledOrganizationFilterError" : { + "message" : "Items in disabled Organizations cannot be accessed. Contact your Organization owner for assistance." + }, "neverLockWarning": { "message": "Are you sure you want to use the \"Never\" option? Setting your lock options to \"Never\" stores your vault's encryption key on your device. If you use this option you should ensure that you keep your device properly protected." } diff --git a/apps/web/src/app/modules/vault-filter/components/organization-filter.component.html b/apps/web/src/app/modules/vault-filter/components/organization-filter.component.html index 0c4bf90eb1e..7ea5c0c92c5 100644 --- a/apps/web/src/app/modules/vault-filter/components/organization-filter.component.html +++ b/apps/web/src/app/modules/vault-filter/components/organization-filter.component.html @@ -129,6 +129,12 @@