1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

[PM-166] [PM-198] - Add Event Logs for CLI Actions (#6527)

* Added the DeviceType changes for windows CLI

* Event logging for CLI commands

* Changing the icons to cli icons
This commit is contained in:
ttalty
2023-11-09 15:17:25 -05:00
committed by GitHub
parent 4446c09fd2
commit 801141f90e
12 changed files with 93 additions and 14 deletions

View File

@@ -1,8 +1,10 @@
import * as program from "commander";
import * as inquirer from "inquirer";
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { EventType } from "@bitwarden/common/enums";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import {
ExportFormat,
@@ -16,7 +18,8 @@ import { CliUtils } from "../utils";
export class ExportCommand {
constructor(
private exportService: VaultExportServiceAbstraction,
private policyService: PolicyService
private policyService: PolicyService,
private eventCollectionService: EventCollectionService
) {}
async run(options: program.OptionValues): Promise<Response> {
@@ -48,6 +51,11 @@ export class ExportCommand {
format === "encrypted_json"
? await this.getProtectedExport(options.password, options.organizationid)
: await this.getUnprotectedExport(format, options.organizationid);
const eventType = options.organizationid
? EventType.Organization_ClientExportedVault
: EventType.User_ClientExportedVault;
this.eventCollectionService.collect(eventType, null, true, options.organizationid);
} catch (e) {
return Response.error(e);
}