fleet
fleet copied to clipboard
Implement soft deletion of users
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
- 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)
- 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:
- Rename
userstable tousers_all, and add adeletedcolumn (nullable timestamp) a. possibly add other audit columns likedeleted_by_id - Update any code that a) modifies the
userstable, or b) selects fromusersbut would want to have deleted users returned; to refer tousers_allinstead - Create new view
userswhich doesSELECT * FROM users_all WHERE deleted IS NULL
QA
Risk assessment
- Requires load testing: No
- Risk level: Low
Test plan
- Perform any action that generates an item in the activity feed with user info attached (e.g. creating a new policy)
- Delete the user that performed the action in the UI
- Verify that the activity feed entry still retains the user's info
- 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
- [ ] Engineer: Added comment to user story confirming successful completion of test plan.
- [ ] QA: Added comment to user story confirming successful completion of test plan.