Skip to content

Commit

Permalink
added user deletion docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobperia committed Jul 11, 2023
1 parent 07b8899 commit 601abe9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/user_deletion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# User Deletion
Deleting a user account revokes their access to the application and soft-deletes the User record. We use the [discard](https://github.com/jhawthorn/discard) gem to soft-delete records across the application.

## How to delete a user account
1. A signed in user goes to their **Account Settings** and clicks the **Delete Account** button, enters their password and optional feedback and then click the **Delete Account Now** button. This will soft-delete the record and sign them out.

## User Anonymization and Customization
We have an optional rake task that anonymizes user records after a period of time. This task calls `AnonymizationService` which strips all columns of the user's data.

1. Run `rake anonymize:users` to anonymize user records that were discarded a certain number of days ago and have not been anonymized yet. The number of days is stored in a constant called `ANONYMIZE_USER_DATA_AFTER_DAYS`.
2. Some fields are set to custom values. For example, `full_name` to **"Deleted User"**, `email` to **"prefix@domain"** where **prefix** and **domain** are customizable and password is set to a secure 60 character **SecureRandom** password.

## Permanentally delete a user record
If for some reason, you'd like to permanentally delete a user record, replace any traces of `discard` with `destroy` being called on a **User** record. The main location where this needs to be replaced is `controllers/registrations_controller.rb` in the **destroy** action.

0 comments on commit 601abe9

Please sign in to comment.