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

[EC-320] Add organization vault export to event logs (#3136)

* Added organizationId to EventData and EventRequest

* Added EventType Organization_ClientExportedVault

* Sending organizationId on Organization Export event

* Checking that the user belongs to the organization

* Added organizationExportResponse model

* Added API method to get Organization vault export data

* Updated getOrganizationDecryptedExport to use new API method
This commit is contained in:
Rui Tomé
2022-07-25 09:56:03 +01:00
committed by GitHub
parent 0f44789d0f
commit b50de43556
11 changed files with 88 additions and 38 deletions

View File

@@ -245,38 +245,41 @@ export class ExportService implements ExportServiceAbstraction {
const promises = [];
promises.push(
this.apiService.getCollections(organizationId).then((collections) => {
const collectionPromises: any = [];
if (collections != null && collections.data != null && collections.data.length > 0) {
collections.data.forEach((c) => {
const collection = new Collection(new CollectionData(c as CollectionDetailsResponse));
collectionPromises.push(
collection.decrypt().then((decCol) => {
decCollections.push(decCol);
})
);
});
}
return Promise.all(collectionPromises);
})
);
promises.push(
this.apiService.getCiphersOrganization(organizationId).then((ciphers) => {
const cipherPromises: any = [];
if (ciphers != null && ciphers.data != null && ciphers.data.length > 0) {
ciphers.data
.filter((c) => c.deletedDate === null)
.forEach((c) => {
const cipher = new Cipher(new CipherData(c));
cipherPromises.push(
cipher.decrypt().then((decCipher) => {
decCiphers.push(decCipher);
this.apiService.getOrganizationExport(organizationId).then((exportData) => {
const exportPromises: any = [];
if (exportData != null) {
if (
exportData.collections != null &&
exportData.collections.data != null &&
exportData.collections.data.length > 0
) {
exportData.collections.data.forEach((c) => {
const collection = new Collection(new CollectionData(c as CollectionDetailsResponse));
exportPromises.push(
collection.decrypt().then((decCol) => {
decCollections.push(decCol);
})
);
});
}
if (
exportData.ciphers != null &&
exportData.ciphers.data != null &&
exportData.ciphers.data.length > 0
) {
exportData.ciphers.data
.filter((c) => c.deletedDate === null)
.forEach((c) => {
const cipher = new Cipher(new CipherData(c));
exportPromises.push(
cipher.decrypt().then((decCipher) => {
decCiphers.push(decCipher);
})
);
});
}
}
return Promise.all(cipherPromises);
return Promise.all(exportPromises);
})
);