fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Implement soft deletion of users

Open sgress454 opened this issue 10 months ago • 0 comments

Goal

User story
As a Fleet customer,
I want Fleet to retain information about users after they are deleted
so that I can maintain an audit trail of actions taken by all users

Key result

  1. Deleting a user in the UI results in that user being marked as delete in the database (soft delete), but not actually removed from the database (hard delete)
  2. The activity list in the UI should continue to show activities from deleted users using their name (optional -- show "(deleted)" or "(deactivated)" after the name)

Context

  • Product designer: @sgress454

Changes

Engineering

  • [X] Test plan is finalized

ℹ️  Please read this issue carefully and understand it. Pay special attention to UI wireframes, especially "dev notes".

This was discussed in backend sync, with the following plan laid out:

  1. Rename users table to users_all, and add a deleted column (nullable timestamp) a. possibly add other audit columns like deleted_by_id
  2. Update any code that a) modifies the users table, or b) selects from users but would want to have deleted users returned; to refer to users_all instead
  3. Create new view users which does SELECT * FROM users_all WHERE deleted IS NULL

QA

Risk assessment

  • Requires load testing: No
  • Risk level: Low

Test plan

  1. Perform any action that generates an item in the activity feed with user info attached (e.g. creating a new policy)
  2. Delete the user that performed the action in the UI
  3. Verify that the activity feed entry still retains the user's info
  4. Verify that other areas of the UI which show user information (e.g. the "Author" info on the Edit Policy and Edit Query pages) still work as expected.

Confirmation

  1. [ ] Engineer: Added comment to user story confirming successful completion of test plan.
  2. [ ] QA: Added comment to user story confirming successful completion of test plan.

sgress454 avatar Apr 02 '25 19:04 sgress454