diff --git a/apps/cli/src/commands/get.command.ts b/apps/cli/src/commands/get.command.ts index 142f0576b5..a91df2a1ca 100644 --- a/apps/cli/src/commands/get.command.ts +++ b/apps/cli/src/commands/get.command.ts @@ -468,7 +468,7 @@ export class GetCommand extends DownloadCommand { if (Utils.isGuid(id)) { org = await this.organizationService.getFromState(id); } else if (id.trim() !== "") { - let orgs = await this.organizationService.getAll(); + let orgs = await firstValueFrom(this.organizationService.organizations$); orgs = CliUtils.searchOrganizations(orgs, id); if (orgs.length > 1) { return Response.multipleResults(orgs.map((c) => c.id)); diff --git a/apps/cli/src/commands/list.command.ts b/apps/cli/src/commands/list.command.ts index 63ec13a8c9..536c9e3b8c 100644 --- a/apps/cli/src/commands/list.command.ts +++ b/apps/cli/src/commands/list.command.ts @@ -1,3 +1,5 @@ +import { firstValueFrom } from "rxjs"; + import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { SearchService } from "@bitwarden/common/abstractions/search.service"; @@ -239,7 +241,7 @@ export class ListCommand { } private async listOrganizations(options: Options) { - let organizations = await this.organizationService.getAll(); + let organizations = await firstValueFrom(this.organizationService.memberOrganizations$); if (options.search != null && options.search.trim() !== "") { organizations = CliUtils.searchOrganizations(organizations, options.search); diff --git a/libs/common/src/admin-console/abstractions/organization/organization.service.abstraction.ts b/libs/common/src/admin-console/abstractions/organization/organization.service.abstraction.ts index 0b0e03e3e1..218051b9e4 100644 --- a/libs/common/src/admin-console/abstractions/organization/organization.service.abstraction.ts +++ b/libs/common/src/admin-console/abstractions/organization/organization.service.abstraction.ts @@ -117,6 +117,9 @@ export abstract class OrganizationService { hasOrganizations: () => Promise; get$: (id: string) => Observable; get: (id: string) => Promise; + /** + * @deprecated This method is only used in key connector and will be removed soon as part of https://bitwarden.atlassian.net/browse/AC-2252. + */ getAll: (userId?: string) => Promise; /**