mirror of
https://github.com/bitwarden/browser
synced 2026-02-24 08:33:29 +00:00
SM-1487-AccessedSecretsandDeletedSecretsBulkMessaging
This commit is contained in:
@@ -470,6 +470,17 @@ export class EventService {
|
||||
msg = this.i18nService.t("accessedSecretWithId", this.formatSecretId(ev));
|
||||
humanReadableMsg = this.i18nService.t("accessedSecretWithId", this.getShortId(ev.secretId));
|
||||
break;
|
||||
case EventType.Secrets_Retrieved_Bulk:
|
||||
msg = this.i18nService.t("accessedSecretWithIds", this.formatSecretIds(ev));
|
||||
humanReadableMsg = this.i18nService.t(
|
||||
"accessedSecretWithIds",
|
||||
this.getShortId(ev.secretId),
|
||||
);
|
||||
break;
|
||||
case EventType.Secrets_Deleted_Bulk:
|
||||
msg = this.i18nService.t("deletedSecretWithIds", this.formatSecretIds(ev));
|
||||
humanReadableMsg = this.i18nService.t("deletedSecretWithIds", this.getShortId(ev.secretId));
|
||||
break;
|
||||
case EventType.Secret_Created:
|
||||
msg = this.i18nService.t("createdSecretWithId", this.formatSecretId(ev));
|
||||
humanReadableMsg = this.i18nService.t("createdSecretWithId", this.getShortId(ev.secretId));
|
||||
@@ -644,6 +655,26 @@ export class EventService {
|
||||
return a.outerHTML;
|
||||
}
|
||||
|
||||
formatSecretIds(ev: EventResponse): string {
|
||||
if (!ev.secretIds || ev.secretIds.trim() === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
const ids = ev.secretIds
|
||||
.split(",")
|
||||
.map((id) => id.trim())
|
||||
.filter((id) => id);
|
||||
|
||||
return ids
|
||||
.map((secretId) => {
|
||||
const shortId = this.getShortId(secretId);
|
||||
const a = this.makeAnchor(shortId);
|
||||
a.setAttribute("href", `#/sm/${ev.organizationId}/secrets?search=${shortId}`);
|
||||
return a.outerHTML;
|
||||
})
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
private makeAnchor(shortId: string) {
|
||||
const a = document.createElement("a");
|
||||
a.title = this.i18nService.t("view");
|
||||
|
||||
@@ -8237,6 +8237,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"accessedSecretWithIds": {
|
||||
"message": "Accessed secrets with the following identifiers: $SECRET_ID$",
|
||||
"placeholders": {
|
||||
"secret_id": {
|
||||
"content": "$1",
|
||||
"example": "4d34e8a8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"accessedSecret": {
|
||||
"message": "Accessed secret $SECRET_ID$.",
|
||||
"placeholders": {
|
||||
@@ -8263,6 +8272,15 @@
|
||||
"example": "4d34e8a8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"deletedSecretWithIds": {
|
||||
"message": "Deleted secrets with these identifiers: $SECRET_ID$",
|
||||
"placeholders": {
|
||||
"secret_id": {
|
||||
"content": "$1",
|
||||
"example": "4d34e8a8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"createdSecretWithId": {
|
||||
"message": "Created a new secret with identifier: $SECRET_ID$",
|
||||
|
||||
@@ -93,4 +93,6 @@ export enum EventType {
|
||||
Secret_Created = 2101,
|
||||
Secret_Edited = 2102,
|
||||
Secret_Deleted = 2103,
|
||||
Secrets_Retrieved_Bulk = 2104,
|
||||
Secrets_Deleted_Bulk = 2105,
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ export class EventResponse extends BaseResponse {
|
||||
domainName: string;
|
||||
secretId: string;
|
||||
serviceAccountId: string;
|
||||
secretIds: string | null;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
@@ -46,5 +47,6 @@ export class EventResponse extends BaseResponse {
|
||||
this.domainName = this.getResponseProperty("DomainName");
|
||||
this.secretId = this.getResponseProperty("SecretId");
|
||||
this.serviceAccountId = this.getResponseProperty("ServiceAccountId");
|
||||
this.secretIds = this.getResponseProperty("SecretIds");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user