diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html index c68b751eb83..62bb0017b29 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html @@ -2,7 +2,7 @@ - + diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.ts index 40bfb717267..86ef7ce3b04 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.ts @@ -1,5 +1,7 @@ import { Component } from "@angular/core"; +import { Organization } from "@bitwarden/common/models/domain/organization"; + import { SecretsManagerLogo } from "./secrets-manager-logo"; @Component({ @@ -8,4 +10,6 @@ import { SecretsManagerLogo } from "./secrets-manager-logo"; }) export class NavigationComponent { protected readonly logo = SecretsManagerLogo; + + protected orgFilter = (org: Organization) => org.canAccessSecretsManager; } diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/layout/org-switcher.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/layout/org-switcher.component.ts index 0da0ac81c7d..e933e91485b 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/layout/org-switcher.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/layout/org-switcher.component.ts @@ -12,13 +12,22 @@ import type { Organization } from "@bitwarden/common/models/domain/organization" export class OrgSwitcherComponent { protected organizations$: Observable = this.organizationService.organizations$.pipe( - map((orgs) => orgs.sort((a, b) => a.name.localeCompare(b.name))) + map((orgs) => orgs.filter(this.filter).sort((a, b) => a.name.localeCompare(b.name))) ); protected activeOrganization$: Observable = combineLatest([ this.route.paramMap, - this.organizationService.organizations$, + this.organizations$, ]).pipe(map(([params, orgs]) => orgs.find((org) => org.id === params.get("organizationId")))); + /** + * Filter function for displayed organizations in the `org-switcher` + * @example + * const smFilter = (org: Organization) => org.canAccessSecretsManager + * // + */ + @Input() + filter: (org: Organization) => boolean = () => true; + /** * Is `true` if the expanded content is visible */