1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

[PM-14613] Remove account deprovisioning feature flag (#14353)

This commit is contained in:
Thomas Rittson
2025-05-07 11:23:18 +10:00
committed by GitHub
parent 744c1b1b49
commit df40954b61
27 changed files with 153 additions and 519 deletions

View File

@@ -11,7 +11,7 @@ import {
} from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { Router } from "@angular/router";
import { filter, firstValueFrom, map, Subject, takeUntil, timeout, withLatestFrom } from "rxjs";
import { filter, firstValueFrom, map, Subject, switchMap, takeUntil, timeout } from "rxjs";
import { CollectionService } from "@bitwarden/admin-console/common";
import { DeviceTrustToastService } from "@bitwarden/angular/auth/services/device-trust-toast.service.abstraction";
@@ -29,7 +29,6 @@ import { UserVerificationService } from "@bitwarden/common/auth/abstractions/use
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/force-set-password-reason";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ProcessReloadServiceAbstraction } from "@bitwarden/common/key-management/abstractions/process-reload.service";
import { KeyConnectorService } from "@bitwarden/common/key-management/key-connector/abstractions/key-connector.service";
import { MasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction";
@@ -820,27 +819,26 @@ export class AppComponent implements OnInit, OnDestroy {
}
private async deleteAccount() {
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
await firstValueFrom(
this.configService.getFeatureFlag$(FeatureFlag.AccountDeprovisioning).pipe(
withLatestFrom(this.organizationService.organizations$(userId)),
map(async ([accountDeprovisioningEnabled, organization]) => {
if (
accountDeprovisioningEnabled &&
organization.some((o) => o.userIsManagedByOrganization === true)
) {
await this.dialogService.openSimpleDialog({
title: { key: "cannotDeleteAccount" },
content: { key: "cannotDeleteAccountDesc" },
cancelButtonText: null,
acceptButtonText: { key: "close" },
type: "danger",
});
} else {
DeleteAccountComponent.open(this.dialogService);
}
}),
const userIsManaged = await firstValueFrom(
this.accountService.activeAccount$.pipe(
getUserId,
switchMap((userId) => this.organizationService.organizations$(userId)),
map((orgs) => orgs.some((o) => o.userIsManagedByOrganization === true)),
),
);
if (userIsManaged) {
await this.dialogService.openSimpleDialog({
title: { key: "cannotDeleteAccount" },
content: { key: "cannotDeleteAccountDesc" },
cancelButtonText: null,
acceptButtonText: { key: "close" },
type: "danger",
});
return;
}
DeleteAccountComponent.open(this.dialogService);
}
}