Impersonation start/stop audit events not appearing on the group-level page
Problem to solve
Audit Events for "impersonation start/stop" are not appearing in the group-level Audit Events page. Although the impersonation actions are appearing, it would be helpful to show the start/stop as well.
Proposal
Audit Events for beginning and ending an impersonation session should appear in the group-level audit log when the impersonated user belongs to a group (in addition to the instance-level audit log as they do already).
In this table, that is represented by the top three rows.
Proposal note
This is about showing instance-level AuditEvents in the group-level Audit log, which is closely related to showing project-level AuditEvents in the group-level Audit log.
Implementation plan
backend weight
-
Update ImpersonationAuditEventService to accept an optional entity
. -
Create a service to create an ImpersonationEvent
for eachuser.groups
in batches as a background job.- See inserting into tables in batches docs.
- Do this only for a the user's direct memberships, ie exclude inherited subgroups.
-
Create a Started Impersonation
inusers_controller.rb
using the new service. -
Create a Stopped Impersonation
inapplication_controller.rb
using the new service. -
Update audit events docs. -
Update specs.