mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
[SM-389] Event log for service account (#4679)
This commit is contained in:
@@ -36,7 +36,7 @@ export class EventService {
|
||||
}
|
||||
|
||||
async getEventInfo(ev: EventResponse, options = new EventOptions()): Promise<EventInfo> {
|
||||
const appInfo = this.getAppInfo(ev.deviceType);
|
||||
const appInfo = this.getAppInfo(ev);
|
||||
const { message, humanReadableMessage } = await this.getEventMessage(ev, options);
|
||||
return {
|
||||
message: message,
|
||||
@@ -410,6 +410,11 @@ export class EventService {
|
||||
case EventType.OrganizationDomain_NotVerified:
|
||||
msg = humanReadableMsg = this.i18nService.t("domainNotVerifiedEvent", ev.domainName);
|
||||
break;
|
||||
// Secrets Manager
|
||||
case EventType.Secret_Retrieved:
|
||||
msg = this.i18nService.t("accessedSecret", this.formatSecretId(ev));
|
||||
humanReadableMsg = this.i18nService.t("accessedSecret", this.getShortId(ev.secretId));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -419,8 +424,12 @@ export class EventService {
|
||||
};
|
||||
}
|
||||
|
||||
private getAppInfo(deviceType: DeviceType): [string, string] {
|
||||
switch (deviceType) {
|
||||
private getAppInfo(ev: EventResponse): [string, string] {
|
||||
if (ev.serviceAccountId) {
|
||||
return ["bwi-globe", this.i18nService.t("sdk")];
|
||||
}
|
||||
|
||||
switch (ev.deviceType) {
|
||||
case DeviceType.Android:
|
||||
return ["bwi-android", this.i18nService.t("mobile") + " - Android"];
|
||||
case DeviceType.iOS:
|
||||
@@ -554,6 +563,13 @@ export class EventService {
|
||||
return a.outerHTML;
|
||||
}
|
||||
|
||||
formatSecretId(ev: EventResponse): string {
|
||||
const shortId = this.getShortId(ev.secretId);
|
||||
const a = this.makeAnchor(shortId);
|
||||
a.setAttribute("href", "#/sm/" + ev.organizationId + "/secrets?search=" + shortId);
|
||||
return a.outerHTML;
|
||||
}
|
||||
|
||||
private makeAnchor(shortId: string) {
|
||||
const a = document.createElement("a");
|
||||
a.title = this.i18nService.t("view");
|
||||
|
||||
Reference in New Issue
Block a user