1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +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

@@ -34,7 +34,8 @@ export class EventService implements EventServiceAbstraction {
async collect(
eventType: EventType,
cipherId: string = null,
uploadImmediately = false
uploadImmediately = false,
organizationId: string = null
): Promise<any> {
const authed = await this.stateService.getIsAuthenticated();
if (!authed) {
@@ -54,6 +55,11 @@ export class EventService implements EventServiceAbstraction {
return;
}
}
if (organizationId != null) {
if (!orgIds.has(organizationId)) {
return;
}
}
let eventCollection = await this.stateService.getEventCollection();
if (eventCollection == null) {
eventCollection = [];
@@ -62,6 +68,7 @@ export class EventService implements EventServiceAbstraction {
event.type = eventType;
event.cipherId = cipherId;
event.date = new Date().toISOString();
event.organizationId = organizationId;
eventCollection.push(event);
await this.stateService.setEventCollection(eventCollection);
if (uploadImmediately) {
@@ -83,6 +90,7 @@ export class EventService implements EventServiceAbstraction {
req.type = e.type;
req.cipherId = e.cipherId;
req.date = e.date;
req.organizationId = e.organizationId;
return req;
});
try {