mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +00:00
[EC-584] Fixed OrganizationExportResponse to correctly parse data (#3641)
* [EC-584] Fixed OrganizationExportResponse to correctly parse data and use CollectionResponse and CipherResponse constructors * [EC-584] Removed ListResponse from OrganizationExportResponse properties * Bumped web version to 2022.10.3 (#3957) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Revert "Bumped web version to 2022.10.3 (#3957)" This reverts commit5d8d547cd2. * Web version bump to 2022.11.0 for QA testing * Revert "Web version bump to 2022.11.0 for QA testing" This reverts commit484db431ed. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com>
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
import { BaseResponse } from "./base.response";
|
import { BaseResponse } from "./base.response";
|
||||||
import { CipherResponse } from "./cipher.response";
|
import { CipherResponse } from "./cipher.response";
|
||||||
import { CollectionResponse } from "./collection.response";
|
import { CollectionResponse } from "./collection.response";
|
||||||
import { ListResponse } from "./list.response";
|
|
||||||
|
|
||||||
export class OrganizationExportResponse extends BaseResponse {
|
export class OrganizationExportResponse extends BaseResponse {
|
||||||
collections: ListResponse<CollectionResponse>;
|
collections: CollectionResponse[];
|
||||||
ciphers: ListResponse<CipherResponse>;
|
ciphers: CipherResponse[];
|
||||||
|
|
||||||
constructor(response: any) {
|
constructor(response: any) {
|
||||||
super(response);
|
super(response);
|
||||||
this.collections = this.getResponseProperty("Collections");
|
const collections = this.getResponseProperty("Collections");
|
||||||
this.ciphers = this.getResponseProperty("Ciphers");
|
if (collections != null) {
|
||||||
|
this.collections = collections.map((c: any) => new CollectionResponse(c));
|
||||||
|
}
|
||||||
|
const ciphers = this.getResponseProperty("Ciphers");
|
||||||
|
if (ciphers != null) {
|
||||||
|
this.ciphers = ciphers.map((c: any) => new CipherResponse(c));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,12 +248,8 @@ export class ExportService implements ExportServiceAbstraction {
|
|||||||
this.apiService.getOrganizationExport(organizationId).then((exportData) => {
|
this.apiService.getOrganizationExport(organizationId).then((exportData) => {
|
||||||
const exportPromises: any = [];
|
const exportPromises: any = [];
|
||||||
if (exportData != null) {
|
if (exportData != null) {
|
||||||
if (
|
if (exportData.collections != null && exportData.collections.length > 0) {
|
||||||
exportData.collections != null &&
|
exportData.collections.forEach((c) => {
|
||||||
exportData.collections.data != null &&
|
|
||||||
exportData.collections.data.length > 0
|
|
||||||
) {
|
|
||||||
exportData.collections.data.forEach((c) => {
|
|
||||||
const collection = new Collection(new CollectionData(c as CollectionDetailsResponse));
|
const collection = new Collection(new CollectionData(c as CollectionDetailsResponse));
|
||||||
exportPromises.push(
|
exportPromises.push(
|
||||||
collection.decrypt().then((decCol) => {
|
collection.decrypt().then((decCol) => {
|
||||||
@@ -262,12 +258,8 @@ export class ExportService implements ExportServiceAbstraction {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (exportData.ciphers != null && exportData.ciphers.length > 0) {
|
||||||
exportData.ciphers != null &&
|
exportData.ciphers
|
||||||
exportData.ciphers.data != null &&
|
|
||||||
exportData.ciphers.data.length > 0
|
|
||||||
) {
|
|
||||||
exportData.ciphers.data
|
|
||||||
.filter((c) => c.deletedDate === null)
|
.filter((c) => c.deletedDate === null)
|
||||||
.forEach((c) => {
|
.forEach((c) => {
|
||||||
const cipher = new Cipher(new CipherData(c));
|
const cipher = new Cipher(new CipherData(c));
|
||||||
|
|||||||
Reference in New Issue
Block a user