Ensure audits for user add-on assignments on association deletion

What does this MR do and why?

Ensure audits for user add-on assignments on association deletion. As PaperTrail creates only audits, when user add-on assignments are deleted directly, we need to adapt the audit creation process for deletion via associations (user, add-on purchases, etc.)

From now on we audit every destroy of user add-on assignments. We still don't track, when an engineer is using delete or delete_all on user add-on assignments.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a group
  2. Go to Settings -> Billing
  3. Apply for an Ultimate + Duo Enterprise Trial
  4. Assign a Duo Enterprise seat to the owner of the group
  5. Check on the Rails console that there is a new GitlabSubscriptions::UserAddOnAssignmentVersion for the event create
  6. Delete the group
  7. Check on the Rails console that there is a new GitlabSubscriptions::UserAddOnAssignmentVersion for the event destroy

Merge request reports

Loading