mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-20333] Remove "export-attachments" feature flag (#14310)
* Remove usage of export-attachments feature flag * Remove export-attachments feature flag definition * Update export.command documentation --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
c4c9db5121
commit
170f97da8e
@@ -10,8 +10,6 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
|||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { EventType } from "@bitwarden/common/enums";
|
import { EventType } from "@bitwarden/common/enums";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import {
|
import {
|
||||||
ExportFormat,
|
ExportFormat,
|
||||||
@@ -30,7 +28,6 @@ export class ExportCommand {
|
|||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
private eventCollectionService: EventCollectionService,
|
private eventCollectionService: EventCollectionService,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
private configService: ConfigService,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async run(options: OptionValues): Promise<Response> {
|
async run(options: OptionValues): Promise<Response> {
|
||||||
@@ -55,13 +52,6 @@ export class ExportCommand {
|
|||||||
const format =
|
const format =
|
||||||
password && options.format == "json" ? "encrypted_json" : (options.format ?? "csv");
|
password && options.format == "json" ? "encrypted_json" : (options.format ?? "csv");
|
||||||
|
|
||||||
if (
|
|
||||||
format == "zip" &&
|
|
||||||
!(await this.configService.getFeatureFlag(FeatureFlag.ExportAttachments))
|
|
||||||
) {
|
|
||||||
return Response.badRequest("Exporting attachments is not supported in this environment.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isSupportedExportFormat(format)) {
|
if (!this.isSupportedExportFormat(format)) {
|
||||||
return Response.badRequest(
|
return Response.badRequest(
|
||||||
`'${format}' is not a supported export format. Supported formats: ${EXPORT_FORMATS.join(
|
`'${format}' is not a supported export format. Supported formats: ${EXPORT_FORMATS.join(
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ export class VaultProgram extends BaseProgram {
|
|||||||
|
|
||||||
private exportCommand(): Command {
|
private exportCommand(): Command {
|
||||||
return new Command("export")
|
return new Command("export")
|
||||||
.description("Export vault data to a CSV or JSON file.")
|
.description("Export vault data to a CSV, JSON or ZIP file.")
|
||||||
.option("--output <output>", "Output directory or filename.")
|
.option("--output <output>", "Output directory or filename.")
|
||||||
.option("--format <format>", "Export file format.")
|
.option("--format <format>", "Export file format.")
|
||||||
.option(
|
.option(
|
||||||
@@ -476,7 +476,7 @@ export class VaultProgram extends BaseProgram {
|
|||||||
writeLn("\n Notes:");
|
writeLn("\n Notes:");
|
||||||
writeLn("");
|
writeLn("");
|
||||||
writeLn(
|
writeLn(
|
||||||
" Valid formats are `csv`, `json`, and `encrypted_json`. Default format is `csv`.",
|
" Valid formats are `csv`, `json`, `encrypted_json` and zip. Default format is `csv`.",
|
||||||
);
|
);
|
||||||
writeLn("");
|
writeLn("");
|
||||||
writeLn(
|
writeLn(
|
||||||
@@ -504,7 +504,6 @@ export class VaultProgram extends BaseProgram {
|
|||||||
this.serviceContainer.policyService,
|
this.serviceContainer.policyService,
|
||||||
this.serviceContainer.eventCollectionService,
|
this.serviceContainer.eventCollectionService,
|
||||||
this.serviceContainer.accountService,
|
this.serviceContainer.accountService,
|
||||||
this.serviceContainer.configService,
|
|
||||||
);
|
);
|
||||||
const response = await command.run(options);
|
const response = await command.run(options);
|
||||||
this.processResponse(response);
|
this.processResponse(response);
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ export enum FeatureFlag {
|
|||||||
CriticalApps = "pm-14466-risk-insights-critical-application",
|
CriticalApps = "pm-14466-risk-insights-critical-application",
|
||||||
EnableRiskInsightsNotifications = "enable-risk-insights-notifications",
|
EnableRiskInsightsNotifications = "enable-risk-insights-notifications",
|
||||||
DesktopSendUIRefresh = "desktop-send-ui-refresh",
|
DesktopSendUIRefresh = "desktop-send-ui-refresh",
|
||||||
ExportAttachments = "export-attachments",
|
|
||||||
|
|
||||||
/* Vault */
|
/* Vault */
|
||||||
PM8851_BrowserOnboardingNudge = "pm-8851-browser-onboarding-nudge",
|
PM8851_BrowserOnboardingNudge = "pm-8851-browser-onboarding-nudge",
|
||||||
@@ -97,7 +96,6 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.CriticalApps]: FALSE,
|
[FeatureFlag.CriticalApps]: FALSE,
|
||||||
[FeatureFlag.EnableRiskInsightsNotifications]: FALSE,
|
[FeatureFlag.EnableRiskInsightsNotifications]: FALSE,
|
||||||
[FeatureFlag.DesktopSendUIRefresh]: FALSE,
|
[FeatureFlag.DesktopSendUIRefresh]: FALSE,
|
||||||
[FeatureFlag.ExportAttachments]: FALSE,
|
|
||||||
|
|
||||||
/* Vault */
|
/* Vault */
|
||||||
[FeatureFlag.PM8851_BrowserOnboardingNudge]: FALSE,
|
[FeatureFlag.PM8851_BrowserOnboardingNudge]: FALSE,
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga
|
|||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { EventType } from "@bitwarden/common/enums";
|
import { EventType } from "@bitwarden/common/enums";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
@@ -184,10 +182,6 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
private onlyManagedCollections = true;
|
private onlyManagedCollections = true;
|
||||||
private onGenerate$ = new Subject<GenerateRequest>();
|
private onGenerate$ = new Subject<GenerateRequest>();
|
||||||
|
|
||||||
private isExportAttachmentsEnabled$ = this.configService.getFeatureFlag$(
|
|
||||||
FeatureFlag.ExportAttachments,
|
|
||||||
);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
protected toastService: ToastService,
|
protected toastService: ToastService,
|
||||||
@@ -202,7 +196,6 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
protected organizationService: OrganizationService,
|
protected organizationService: OrganizationService,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
private collectionService: CollectionService,
|
private collectionService: CollectionService,
|
||||||
private configService: ConfigService,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -225,17 +218,14 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
combineLatest([
|
this.exportForm.controls.vaultSelector.valueChanges
|
||||||
this.exportForm.controls.vaultSelector.valueChanges,
|
|
||||||
this.isExportAttachmentsEnabled$,
|
|
||||||
])
|
|
||||||
.pipe(takeUntil(this.destroy$))
|
.pipe(takeUntil(this.destroy$))
|
||||||
.subscribe(([value, isExportAttachmentsEnabled]) => {
|
.subscribe(([value]) => {
|
||||||
this.organizationId = value !== "myVault" ? value : undefined;
|
this.organizationId = value !== "myVault" ? value : undefined;
|
||||||
|
|
||||||
this.formatOptions = this.formatOptions.filter((option) => option.value !== "zip");
|
this.formatOptions = this.formatOptions.filter((option) => option.value !== "zip");
|
||||||
this.exportForm.get("format").setValue("json");
|
this.exportForm.get("format").setValue("json");
|
||||||
if (value === "myVault" && isExportAttachmentsEnabled) {
|
if (value === "myVault") {
|
||||||
this.formatOptions.push({ name: ".zip (with attachments)", value: "zip" });
|
this.formatOptions.push({ name: ".zip (with attachments)", value: "zip" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user