Added event log for resend invite and reminder sent. Also included scheduled job system type. (#24440)

This commit is contained in:
Jared McCannon
2026-11-10 09:22:18 -06:00
committed by GitHub
parent ffe366b0c0
commit 6e6f982fab
7 changed files with 111 additions and 0 deletions

View File

@@ -191,6 +191,46 @@ describe("EventsComponent Send access linking", () => {
});
});
describe("getUserName (invite reminder and resend events)", () => {
it("names System for a reminder sent by the scheduled job", () => {
const user = component.getUserName(
{
type: EventType.OrganizationUser_InviteReminderSent,
actingUserId: null,
userId: null,
systemUser: EventSystemUser.ScheduledJob,
},
null,
);
expect(user.name).toBe("system");
});
it("names Public API for a resend through the Public API", () => {
const user = component.getUserName(
{
type: EventType.OrganizationUser_Reinvited,
actingUserId: null,
userId: null,
systemUser: EventSystemUser.PublicApi,
},
null,
);
expect(user.name).toBe("publicApi");
});
it("names the admin for a resend by an admin", () => {
const user = component.getUserName(
{
type: EventType.OrganizationUser_Reinvited,
actingUserId: "creator-user-id",
systemUser: null,
},
"creator-user-id",
);
expect(user.name).toBe("Pat Owner");
});
});
describe("interactive id clicks open a dialog in place", () => {
it("opens a Send-scoped events dialog when a Send id is clicked (and does NOT navigate)", () => {
component.onEventMessageClick(clickOnHref(SEND_EVENTS_HREF_PREFIX + "send-123"));

View File

@@ -57,6 +57,7 @@ const EVENT_SYSTEM_USER_TO_TRANSLATION: Record<EventSystemUser, string> = {
[EventSystemUser.PublicApi]: "publicApi",
[EventSystemUser.BitwardenPortal]: "system",
[EventSystemUser.Pam]: "privilegedControls",
[EventSystemUser.ScheduledJob]: "system",
};
@Component({

View File

@@ -552,3 +552,38 @@ describe("EventService PAM events", () => {
expect(info.humanReadableMessage).toContain(accessRequestId.substring(0, 8));
});
});
describe("EventService invite reminder and resend events", () => {
let sut: EventService;
const i18n = mock<I18nService>();
i18n.t.mockImplementation((id: string, p1?: string) => `${id}${p1 ?? ""}`);
beforeEach(() => {
const policyService = mock<PolicyService>();
policyService.policies$.mockReturnValue(of([]));
const accountService = mock<AccountService>();
(accountService as any).activeAccount$ = of({ id: "user-id" });
const configService = mock<ConfigService>();
configService.getFeatureFlag.mockResolvedValue(false);
sut = new EventService(i18n, policyService, accountService, configService);
});
const organizationUserId = "7c1d2e3f-1111-2222-3333-444455556666";
it.each([
[EventType.OrganizationUser_InviteReminderSent, "sentInviteReminderToUserId"],
[EventType.OrganizationUser_Reinvited, "resentInviteToUserId"],
])("renders %s with the member's short id", async (type, key) => {
const info = await sut.getEventInfo({
type,
organizationUserId,
organizationId: "org-1111-2222",
} as EventResponse);
expect(info.message).toContain(key);
expect(info.message).toContain(organizationUserId.substring(0, 8));
expect(info.humanReadableMessage).toBe(`${key}${organizationUserId.substring(0, 8)}`);
});
});

View File

@@ -553,6 +553,20 @@ export class EventService {
this.getShortId(ev.organizationUserId),
);
break;
case EventType.OrganizationUser_InviteReminderSent:
msg = this.i18nService.t("sentInviteReminderToUserId", this.formatOrgUserId(ev));
humanReadableMsg = this.i18nService.t(
"sentInviteReminderToUserId",
this.getShortId(ev.organizationUserId),
);
break;
case EventType.OrganizationUser_Reinvited:
msg = this.i18nService.t("resentInviteToUserId", this.formatOrgUserId(ev));
humanReadableMsg = this.i18nService.t(
"resentInviteToUserId",
this.getShortId(ev.organizationUserId),
);
break;
// Org
case EventType.Organization_Updated:
msg = humanReadableMsg = this.i18nService.t("editedOrgSettings");

View File

@@ -9484,6 +9484,24 @@
}
}
},
"sentInviteReminderToUserId": {
"message": "Sent invite reminder to user $ID$.",
"placeholders": {
"id": {
"content": "$1",
"example": "First 8 characters of a GUID"
}
}
},
"resentInviteToUserId": {
"message": "Resent invite to user $ID$.",
"placeholders": {
"id": {
"content": "$1",
"example": "First 8 characters of a GUID"
}
}
},
"system": {
"message": "System"
},

View File

@@ -7,4 +7,5 @@ export enum EventSystemUser {
PublicApi = 3,
BitwardenPortal = 5,
Pam = 6,
ScheduledJob = 7,
}

View File

@@ -85,6 +85,8 @@ export enum EventType {
OrganizationUser_InviteLinkAccepted = 1524,
OrganizationUser_AdminChangedEmail = 1525,
OrganizationUser_InviteLinkConfirmed = 1526,
OrganizationUser_InviteReminderSent = 1527,
OrganizationUser_Reinvited = 1528,
Organization_Updated = 1600,
Organization_PurgedVault = 1601,