Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate existing organizations state from StateServiceStateProvider #7895

Merged
merged 33 commits into from Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0b51d67
Migrate OrganizationService to StateProvider
addisonbeck Feb 27, 2024
cea6af0
Update libs/common/src/admin-console/services/organization/organizati…
addisonbeck Feb 28, 2024
2fdd09a
Remove deprecation notices
addisonbeck Feb 28, 2024
b9a05b4
Move functions inline with their one calling class
addisonbeck Feb 28, 2024
9fd1b6d
Rename `mapToExcludeSpecialOrganizations`
addisonbeck Feb 28, 2024
a5d1e28
Remove unecassary object assignment in `getAll()`
addisonbeck Feb 28, 2024
5a114f6
Rework existing interface methods to be promises
addisonbeck Feb 28, 2024
9017006
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Feb 28, 2024
4e85329
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Feb 29, 2024
613248d
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 1, 2024
ebd9e11
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 1, 2024
b6a1632
Update a comment
addisonbeck Mar 1, 2024
77e0f90
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 1, 2024
0f37d05
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 1, 2024
70058c3
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 4, 2024
35623e3
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 4, 2024
f805309
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 5, 2024
0429340
Remove complex and unecassary assertion
addisonbeck Mar 5, 2024
d91d842
Remove unecassary test logic
addisonbeck Mar 5, 2024
36434d1
Add back a deprecation notice
addisonbeck Mar 5, 2024
eda7f94
Make test assertion less code-y
addisonbeck Mar 11, 2024
7b5039f
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 11, 2024
a354c75
Implement UserKeyDefinition for Organizations
addisonbeck Mar 11, 2024
5fec465
Rework complex assertion one more time
addisonbeck Mar 11, 2024
3760082
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 13, 2024
43419f5
Rework complex assertion one-more-one-more-time
addisonbeck Mar 13, 2024
76a7e4d
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 13, 2024
1e995ca
Remove stateService Organizations logic
addisonbeck Mar 13, 2024
ce86d04
Update tests to reflect new async methods
addisonbeck Mar 13, 2024
5a0b15e
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 13, 2024
d6eb3e1
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 14, 2024
d1ce9f8
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 15, 2024
d2f9644
Merge branch 'main' into AC-2009/migrate-organization-state
addisonbeck Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
addisonbeck marked this conversation as resolved.
Show resolved Hide resolved
@@ -1,16 +1,13 @@
import { OrganizationService as AbstractOrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { OrganizationService } from "@bitwarden/common/admin-console/services/organization/organization.service";

import {
FactoryOptions,
CachedServices,
factory,
} from "../../../platform/background/service-factories/factory-options";
import { stateProviderFactory } from "../../../platform/background/service-factories/state-provider.factory";
import {
stateServiceFactory,
StateServiceInitOptions,
} from "../../../platform/background/service-factories/state-service.factory";
import { BrowserOrganizationService } from "../../services/browser-organization.service";
import { StateServiceInitOptions } from "../../../platform/background/service-factories/state-service.factory";

type OrganizationServiceFactoryOptions = FactoryOptions;

Expand All @@ -25,10 +22,6 @@
cache,
"organizationService",
opts,
async () =>
new BrowserOrganizationService(
await stateServiceFactory(cache, opts),
await stateProviderFactory(cache, opts),
),
async () => new OrganizationService(await stateProviderFactory(cache, opts)),

Check warning on line 25 in apps/browser/src/admin-console/background/service-factories/organization-service.factory.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/admin-console/background/service-factories/organization-service.factory.ts#L25

Added line #L25 was not covered by tests
);
}

This file was deleted.

7 changes: 2 additions & 5 deletions apps/browser/src/background/main.background.ts
Expand Up @@ -20,6 +20,7 @@
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
import { InternalPolicyService as InternalPolicyServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { ProviderService as ProviderServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/provider.service";
import { OrganizationService } from "@bitwarden/common/admin-console/services/organization/organization.service";

Check warning on line 23 in apps/browser/src/background/main.background.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/background/main.background.ts#L23

Added line #L23 was not covered by tests
import { PolicyApiService } from "@bitwarden/common/admin-console/services/policy/policy-api.service";
import { PolicyService } from "@bitwarden/common/admin-console/services/policy/policy.service";
import { ProviderService } from "@bitwarden/common/admin-console/services/provider.service";
Expand Down Expand Up @@ -180,7 +181,6 @@
VaultExportServiceAbstraction,
} from "@bitwarden/vault-export-core";

import { BrowserOrganizationService } from "../admin-console/services/browser-organization.service";
import ContextMenusBackground from "../autofill/background/context-menus.background";
import NotificationBackground from "../autofill/background/notification.background";
import OverlayBackground from "../autofill/background/overlay.background";
Expand Down Expand Up @@ -490,10 +490,7 @@
this.stateProvider,
);
this.syncNotifierService = new SyncNotifierService();
this.organizationService = new BrowserOrganizationService(
this.stateService,
this.stateProvider,
);
this.organizationService = new OrganizationService(this.stateProvider);

Check warning on line 493 in apps/browser/src/background/main.background.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/background/main.background.ts#L493

Added line #L493 was not covered by tests
this.policyService = new PolicyService(this.stateProvider, this.organizationService);
this.autofillSettingsService = new AutofillSettingsService(
this.stateProvider,
Expand Down
8 changes: 0 additions & 8 deletions apps/browser/src/popup/services/services.module.ts
Expand Up @@ -98,7 +98,6 @@ import { DialogService } from "@bitwarden/components";
import { ImportServiceAbstraction } from "@bitwarden/importer/core";
import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core";

import { BrowserOrganizationService } from "../../admin-console/services/browser-organization.service";
import { UnauthGuardService } from "../../auth/popup/services";
import { AutofillService } from "../../autofill/services/abstractions/autofill.service";
import MainBackground from "../../background/main.background";
Expand Down Expand Up @@ -399,13 +398,6 @@ function getBgService<T>(service: keyof MainBackground) {
useFactory: getBgService<NotificationsService>("notificationsService"),
deps: [],
},
{
provide: OrganizationService,
useFactory: (stateService: StateServiceAbstraction, stateProvider: StateProvider) => {
return new BrowserOrganizationService(stateService, stateProvider);
},
deps: [StateServiceAbstraction, StateProvider],
},
{
provide: VaultFilterService,
useClass: VaultFilterService,
Expand Down
Expand Up @@ -275,7 +275,7 @@
const dontShowIdentities = !(await firstValueFrom(
this.vaultSettingsService.showIdentitiesCurrentTab$,
));
this.showOrganizations = this.organizationService.hasOrganizations();
this.showOrganizations = await this.organizationService.hasOrganizations();

Check warning on line 278 in apps/browser/src/vault/popup/components/vault/current-tab.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault/current-tab.component.ts#L278

Added line #L278 was not covered by tests
if (!dontShowCards) {
otherTypes.push(CipherType.Card);
}
Expand Down
Expand Up @@ -74,7 +74,7 @@

async ngOnInit() {
this.searchTypeSearch = !this.platformUtilsService.isSafari();
this.showOrganizations = this.organizationService.hasOrganizations();
this.showOrganizations = await this.organizationService.hasOrganizations();

Check warning on line 77 in apps/browser/src/vault/popup/components/vault/vault-items.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/popup/components/vault/vault-items.component.ts#L77

Added line #L77 was not covered by tests
this.vaultFilter = this.vaultFilterService.getVaultFilter();
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/bw.ts
Expand Up @@ -400,7 +400,7 @@

this.providerService = new ProviderService(this.stateProvider);

this.organizationService = new OrganizationService(this.stateService, this.stateProvider);
this.organizationService = new OrganizationService(this.stateProvider);

Check warning on line 403 in apps/cli/src/bw.ts

View check run for this annotation

Codecov / codecov/patch

apps/cli/src/bw.ts#L403

Added line #L403 was not covered by tests

this.organizationUserService = new OrganizationUserServiceImplementation(this.apiService);

Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/app/app.component.ts
Expand Up @@ -22,6 +22,7 @@
import { SettingsService } from "@bitwarden/common/abstractions/settings.service";
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout.service";
import { InternalOrganizationServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";

Check warning on line 25 in apps/desktop/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/app/app.component.ts#L25

Added line #L25 was not covered by tests
import { InternalPolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service";
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
Expand Down Expand Up @@ -153,6 +154,7 @@
private biometricStateService: BiometricStateService,
private stateEventRunnerService: StateEventRunnerService,
private providerService: ProviderService,
private organizationService: InternalOrganizationServiceAbstraction,

Check warning on line 157 in apps/desktop/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/app/app.component.ts#L157

Added line #L157 was not covered by tests
) {}

ngOnInit() {
Expand Down
Expand Up @@ -17,7 +17,7 @@
) {}

async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const org = this.organizationService.get(route.params.organizationId);
const org = await this.organizationService.get(route.params.organizationId);

Check warning on line 20 in apps/web/src/app/admin-console/organizations/guards/is-paid-org.guard.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/guards/is-paid-org.guard.ts#L20

Added line #L20 was not covered by tests

if (org == null) {
return this.router.createUrlTree(["/"]);
Expand Down
Expand Up @@ -66,7 +66,7 @@ describe("Organization Permissions Guard", () => {

it("permits navigation if no permissions are specified", async () => {
const org = orgFactory();
organizationService.get.calledWith(org.id).mockReturnValue(org);
organizationService.get.calledWith(org.id).mockResolvedValue(org);

const actual = await organizationPermissionsGuard.canActivate(route, state);

Expand All @@ -81,7 +81,7 @@ describe("Organization Permissions Guard", () => {
};

const org = orgFactory();
organizationService.get.calledWith(org.id).mockReturnValue(org);
organizationService.get.calledWith(org.id).mockResolvedValue(org);

const actual = await organizationPermissionsGuard.canActivate(route, state);

Expand All @@ -104,7 +104,7 @@ describe("Organization Permissions Guard", () => {
});

const org = orgFactory();
organizationService.get.calledWith(org.id).mockReturnValue(org);
organizationService.get.calledWith(org.id).mockResolvedValue(org);

const actual = await organizationPermissionsGuard.canActivate(route, state);

Expand All @@ -124,7 +124,7 @@ describe("Organization Permissions Guard", () => {
}),
});
const org = orgFactory();
organizationService.get.calledWith(org.id).mockReturnValue(org);
organizationService.get.calledWith(org.id).mockResolvedValue(org);

const actual = await organizationPermissionsGuard.canActivate(route, state);

Expand All @@ -141,7 +141,7 @@ describe("Organization Permissions Guard", () => {
type: OrganizationUserType.Admin,
enabled: false,
});
organizationService.get.calledWith(org.id).mockReturnValue(org);
organizationService.get.calledWith(org.id).mockResolvedValue(org);

const actual = await organizationPermissionsGuard.canActivate(route, state);

Expand All @@ -153,7 +153,7 @@ describe("Organization Permissions Guard", () => {
type: OrganizationUserType.Owner,
enabled: false,
});
organizationService.get.calledWith(org.id).mockReturnValue(org);
organizationService.get.calledWith(org.id).mockResolvedValue(org);

const actual = await organizationPermissionsGuard.canActivate(route, state);

Expand Down
Expand Up @@ -28,7 +28,7 @@ export class OrganizationPermissionsGuard implements CanActivate {
await this.syncService.fullSync(false);
}

const org = this.organizationService.get(route.params.organizationId);
const org = await this.organizationService.get(route.params.organizationId);
if (org == null) {
return this.router.createUrlTree(["/"]);
}
Expand Down
Expand Up @@ -16,7 +16,7 @@
) {}

async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const org = this.organizationService.get(route.params.organizationId);
const org = await this.organizationService.get(route.params.organizationId);

Check warning on line 19 in apps/web/src/app/admin-console/organizations/guards/org-redirect.guard.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/guards/org-redirect.guard.ts#L19

Added line #L19 was not covered by tests

const customRedirect = route.data?.autoRedirectCallback;
if (customRedirect) {
Expand Down
Expand Up @@ -143,7 +143,7 @@

async ngOnInit() {
const organization$ = this.route.params.pipe(
map((params) => this.organizationService.get(params.organizationId)),
concatMap((params) => this.organizationService.get$(params.organizationId)),

Check warning on line 146 in apps/web/src/app/admin-console/organizations/members/people.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/members/people.component.ts#L146

Added line #L146 was not covered by tests
shareReplay({ refCount: true, bufferSize: 1 }),
);

Expand Down
@@ -1,6 +1,6 @@
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, NavigationEnd, Router } from "@angular/router";
import { filter, map, Observable, startWith } from "rxjs";
import { filter, map, Observable, startWith, concatMap } from "rxjs";

Check warning on line 3 in apps/web/src/app/admin-console/organizations/reporting/reports-home.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/reporting/reports-home.component.ts#L3

Added line #L3 was not covered by tests

import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
Expand Down Expand Up @@ -30,7 +30,7 @@
);

this.reports$ = this.route.params.pipe(
map((params) => this.organizationService.get(params.organizationId)),
concatMap((params) => this.organizationService.get$(params.organizationId)),

Check warning on line 33 in apps/web/src/app/admin-console/organizations/reporting/reports-home.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/reporting/reports-home.component.ts#L33

Added line #L33 was not covered by tests
map((org) => this.buildReports(org.isFreeOrg)),
);
}
Expand Down
@@ -1,6 +1,6 @@
import { Component } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { concatMap, takeUntil } from "rxjs";
import { concatMap, takeUntil, map } from "rxjs";

Check warning on line 3 in apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts#L3

Added line #L3 was not covered by tests
import { tap } from "rxjs/operators";

import { ModalService } from "@bitwarden/angular/services/modal.service";
Expand Down Expand Up @@ -36,9 +36,14 @@
async ngOnInit() {
this.route.params
.pipe(
tap((params) => {
this.organizationId = params.organizationId;
this.organization = this.organizationService.get(this.organizationId);
concatMap((params) =>
this.organizationService

Check warning on line 40 in apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts#L40

Added line #L40 was not covered by tests
.get$(params.organizationId)
.pipe(map((organization) => ({ params, organization }))),

Check warning on line 42 in apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts#L42

Added line #L42 was not covered by tests
),
tap(async (mapResponse) => {
this.organizationId = mapResponse.params.organizationId;
this.organization = mapResponse.organization;

Check warning on line 46 in apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts#L44-L46

Added lines #L44 - L46 were not covered by tests
}),
concatMap(async () => await super.ngOnInit()),
takeUntil(this.destroy$),
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/app.component.ts
Expand Up @@ -11,7 +11,7 @@
import { SearchService } from "@bitwarden/common/abstractions/search.service";
import { SettingsService } from "@bitwarden/common/abstractions/settings.service";
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { InternalOrganizationServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";

Check warning on line 14 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L14

Added line #L14 was not covered by tests
import { InternalPolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
import { KeyConnectorService } from "@bitwarden/common/auth/abstractions/key-connector.service";
Expand Down Expand Up @@ -92,7 +92,7 @@
private biometricStateService: BiometricStateService,
private stateEventRunnerService: StateEventRunnerService,
private paymentMethodWarningService: PaymentMethodWarningService,
private organizationService: OrganizationService,
private organizationService: InternalOrganizationServiceAbstraction,

Check warning on line 95 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L95

Added line #L95 was not covered by tests
) {}

ngOnInit() {
Expand Down
Expand Up @@ -150,7 +150,7 @@

async ngOnInit() {
if (this.organizationId) {
this.organization = this.organizationService.get(this.organizationId);
this.organization = await this.organizationService.get(this.organizationId);

Check warning on line 153 in apps/web/src/app/billing/organizations/organization-plans.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-plans.component.ts#L153

Added line #L153 was not covered by tests
this.billing = await this.organizationApiService.getBilling(this.organizationId);
this.sub = await this.organizationApiService.getSubscription(this.organizationId);
}
Expand Down
Expand Up @@ -94,7 +94,7 @@
return;
}
this.loading = true;
this.userOrg = this.organizationService.get(this.organizationId);
this.userOrg = await this.organizationService.get(this.organizationId);

Check warning on line 97 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L97

Added line #L97 was not covered by tests
if (this.userOrg.canViewSubscription) {
this.sub = await this.organizationApiService.getSubscription(this.organizationId);
this.lineItems = this.sub?.subscription?.items;
Expand Down
Expand Up @@ -110,7 +110,7 @@
return;
}
this.loading = true;
this.userOrg = this.organizationService.get(this.organizationId);
this.userOrg = await this.organizationService.get(this.organizationId);

Check warning on line 113 in apps/web/src/app/billing/organizations/organization-subscription-selfhost.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-selfhost.component.ts#L113

Added line #L113 was not covered by tests
if (this.userOrg.canViewSubscription) {
const subscriptionResponse = await this.organizationApiService.getSubscription(
this.organizationId,
Expand Down
Expand Up @@ -139,9 +139,9 @@
}

async loadOrg(orgId: string, collectionIds: string[]) {
const organization$ = of(this.organizationService.get(orgId)).pipe(
shareReplay({ refCount: true, bufferSize: 1 }),
);
const organization$ = this.organizationService

Check warning on line 142 in apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.ts#L142

Added line #L142 was not covered by tests
.get$(orgId)
.pipe(shareReplay({ refCount: true, bufferSize: 1 }));
const groups$ = organization$.pipe(
switchMap((organization) => {
if (!organization.useGroups) {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/vault/individual-vault/vault.component.ts
Expand Up @@ -520,7 +520,7 @@
this.messagingService.send("premiumRequired");
return;
} else if (cipher.organizationId != null) {
const org = this.organizationService.get(cipher.organizationId);
const org = await this.organizationService.get(cipher.organizationId);

Check warning on line 523 in apps/web/src/app/vault/individual-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/individual-vault/vault.component.ts#L523

Added line #L523 was not covered by tests
if (org != null && (org.maxStorageGb == null || org.maxStorageGb === 0)) {
this.messagingService.send("upgradeOrganization", {
organizationId: cipher.organizationId,
Expand Down Expand Up @@ -699,7 +699,7 @@
}

async deleteCollection(collection: CollectionView): Promise<void> {
const organization = this.organizationService.get(collection.organizationId);
const organization = await this.organizationService.get(collection.organizationId);

Check warning on line 702 in apps/web/src/app/vault/individual-vault/vault.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/vault/individual-vault/vault.component.ts#L702

Added line #L702 was not covered by tests
if (!collection.canDelete(organization)) {
this.platformUtilsService.showToast(
"error",
Expand Down
Expand Up @@ -16,7 +16,7 @@
await syncService.fullSync(false);
}

const org = orgService.get(route.params.organizationId);
const org = await orgService.get(route.params.organizationId);

Check warning on line 19 in bitwarden_license/bit-web/src/app/secrets-manager/guards/sm-org-enabled.guard.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/secrets-manager/guards/sm-org-enabled.guard.ts#L19

Added line #L19 was not covered by tests
if (org == null || !org.canAccessSecretsManager) {
return createUrlTreeFromSnapshot(route, ["/"]);
}
Expand Down
Expand Up @@ -14,7 +14,7 @@ export class NavigationComponent {
protected readonly logo = SecretsManagerLogo;
protected orgFilter = (org: Organization) => org.canAccessSecretsManager;
protected isAdmin$ = this.route.params.pipe(
map((params) => this.organizationService.get(params.organizationId)?.isAdmin),
map(async (params) => (await this.organizationService.get(params.organizationId))?.isAdmin),
);

constructor(
Expand Down
Expand Up @@ -12,6 +12,7 @@
take,
share,
firstValueFrom,
concatMap,
} from "rxjs";

import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
Expand Down Expand Up @@ -105,7 +106,7 @@

orgId$
.pipe(
map((orgId) => this.organizationService.get(orgId)),
concatMap(async (orgId) => await this.organizationService.get(orgId)),

Check warning on line 109 in bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bit-web/src/app/secrets-manager/overview/overview.component.ts#L109

Added line #L109 was not covered by tests
takeUntil(this.destroy$),
)
.subscribe((org) => {
Expand Down
Expand Up @@ -63,7 +63,9 @@ export class ProjectSecretsComponent {
switchMap(async ([_, params]) => {
this.organizationId = params.organizationId;
this.projectId = params.projectId;
this.organizationEnabled = this.organizationService.get(params.organizationId)?.enabled;
this.organizationEnabled = (
await this.organizationService.get(params.organizationId)
)?.enabled;
return await this.getSecretsByProject();
}),
);
Expand Down