2018-07-05 20:40:53 +02:00
|
|
|
import { Component } from "@angular/core";
|
2022-07-26 14:48:11 +02:00
|
|
|
import { UntypedFormBuilder } from "@angular/forms";
|
2018-07-05 20:40:53 +02:00
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
|
|
|
import { EventService } from "@bitwarden/common/abstractions/event.service";
|
|
|
|
import { ExportService } from "@bitwarden/common/abstractions/export.service";
|
2022-06-29 23:15:29 +02:00
|
|
|
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
|
2022-06-14 17:10:53 +02:00
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
|
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|
|
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
2022-08-08 11:04:36 +02:00
|
|
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
2022-08-10 03:31:02 +02:00
|
|
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
|
2022-07-25 10:56:03 +02:00
|
|
|
import { EventType } from "@bitwarden/common/enums/eventType";
|
2018-07-05 20:40:53 +02:00
|
|
|
|
2022-06-28 22:24:21 +02:00
|
|
|
import { ExportComponent } from "../../../tools/import-export/export.component";
|
2019-08-09 17:14:46 +02:00
|
|
|
|
2018-07-05 20:40:53 +02:00
|
|
|
@Component({
|
|
|
|
selector: "app-org-export",
|
2022-06-28 22:24:21 +02:00
|
|
|
templateUrl: "../../../tools/import-export/export.component.html",
|
2018-07-05 20:40:53 +02:00
|
|
|
})
|
2022-08-26 18:09:28 +02:00
|
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
2022-06-28 22:24:21 +02:00
|
|
|
export class OrganizationExportComponent extends ExportComponent {
|
2018-10-03 16:33:04 +02:00
|
|
|
constructor(
|
|
|
|
cryptoService: CryptoService,
|
|
|
|
i18nService: I18nService,
|
2018-08-14 21:14:04 +02:00
|
|
|
platformUtilsService: PlatformUtilsService,
|
|
|
|
exportService: ExportService,
|
2021-10-20 18:30:04 +02:00
|
|
|
eventService: EventService,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
policyService: PolicyService,
|
2021-11-09 19:24:26 +01:00
|
|
|
logService: LogService,
|
|
|
|
userVerificationService: UserVerificationService,
|
2022-07-26 14:48:11 +02:00
|
|
|
formBuilder: UntypedFormBuilder,
|
2022-06-29 23:15:29 +02:00
|
|
|
fileDownloadService: FileDownloadService
|
2021-11-09 19:24:26 +01:00
|
|
|
) {
|
2021-10-20 18:30:04 +02:00
|
|
|
super(
|
|
|
|
cryptoService,
|
|
|
|
i18nService,
|
|
|
|
platformUtilsService,
|
|
|
|
exportService,
|
|
|
|
eventService,
|
|
|
|
policyService,
|
2021-11-09 19:24:26 +01:00
|
|
|
logService,
|
|
|
|
userVerificationService,
|
2022-06-29 23:15:29 +02:00
|
|
|
formBuilder,
|
|
|
|
fileDownloadService
|
2021-11-09 19:24:26 +01:00
|
|
|
);
|
2018-07-05 20:40:53 +02:00
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2021-09-15 21:05:02 +02:00
|
|
|
async ngOnInit() {
|
2022-08-26 18:09:28 +02:00
|
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
2021-02-03 18:41:33 +01:00
|
|
|
this.route.parent.parent.params.subscribe(async (params) => {
|
2018-07-05 20:40:53 +02:00
|
|
|
this.organizationId = params.organizationId;
|
|
|
|
});
|
2022-02-28 17:37:02 +01:00
|
|
|
await super.ngOnInit();
|
2018-07-05 20:40:53 +02:00
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2021-09-15 21:05:02 +02:00
|
|
|
async checkExportDisabled() {
|
|
|
|
return;
|
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2018-07-05 20:40:53 +02:00
|
|
|
getExportData() {
|
2018-12-17 16:54:18 +01:00
|
|
|
return this.exportService.getOrganizationExport(this.organizationId, this.format);
|
2018-07-05 20:40:53 +02:00
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2018-07-05 20:40:53 +02:00
|
|
|
getFileName() {
|
|
|
|
return super.getFileName("org");
|
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2022-08-10 03:31:02 +02:00
|
|
|
async collectEvent(): Promise<void> {
|
2022-07-25 10:56:03 +02:00
|
|
|
await this.eventService.collect(
|
|
|
|
EventType.Organization_ClientExportedVault,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
this.organizationId
|
|
|
|
);
|
2019-07-12 23:11:50 +02:00
|
|
|
}
|
2018-07-05 20:40:53 +02:00
|
|
|
}
|