[PM-7603] Fix individual vault export not appearing on Event Logs (#8829)

* Added validation to update User_ClientExportedVault on events even with no organization id or cipher id

* Fixed missing data and validation
This commit is contained in:
aj-rosado 2024-04-22 10:18:11 +01:00 committed by GitHub
parent 91f1d9fb86
commit f829cdd8a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -36,7 +36,7 @@ export class EventCollectionService implements EventCollectionServiceAbstraction
const userId = await firstValueFrom(this.stateProvider.activeUserId$);
const eventStore = this.stateProvider.getUser(userId, EVENT_COLLECTION);
if (!(await this.shouldUpdate(cipherId, organizationId))) {
if (!(await this.shouldUpdate(cipherId, organizationId, eventType))) {
return;
}
@ -64,6 +64,7 @@ export class EventCollectionService implements EventCollectionServiceAbstraction
private async shouldUpdate(
cipherId: string = null,
organizationId: string = null,
eventType: EventType = null,
): Promise<boolean> {
const orgIds$ = this.organizationService.organizations$.pipe(
map((orgs) => orgs?.filter((o) => o.useEvents)?.map((x) => x.id) ?? []),
@ -85,6 +86,11 @@ export class EventCollectionService implements EventCollectionServiceAbstraction
return false;
}
// Individual vault export doesn't need cipher id or organization id.
if (eventType == EventType.User_ClientExportedVault) {
return true;
}
// If the cipher is null there must be an organization id provided
if (cipher == null && organizationId == null) {
return false;