Deleting expired applications
- Dominant language
- Clojure
- Stars
- 66
- Forks
- 28
- Avg merge
- 7d 4h
- Merged PRs (30d)
- 2
Description
We will introduce a way for the applications to expire and finally be automatically deleted after a grace period.
This feature will be by default off, but can be enabled with config.
Applications can have different retention times. Instead of one fixed retention period, the application expiration date will be determined by the application handler when they processes the application (approve/reject/close) and saved on the application.
When an application reaches its expiration date:
1. The application enters a grace period (default 90 days, configurable?).
2. The applicant receives one or more? notifications about the upcoming deletion.
3. After the grace period ends, the application is permanently deleted.
If no expiration date is set, the application will not expire.
Use already existing expirer-bot to
- Find applications that will expire soon (related #2348 )
- Set the application state to soft-delete (#3478 )
- Send notifications
- Delete application
To be defined:
- At which state should the expiration date be set? Before application is set to approved, rejected or closed (approved & rejected can still be closed, should the expiration date be set earlier or in all states)?
- In which states can an application be deleted? approved, rejected, closed, revoked?
- Will the expired application be hidden from applicants during the grace period?
- Application could still be found with its ID so it can be downloaded, but it wouldn't be visible in UI tables so that
- We would somehow indicate in the UI that something will expire? Similar colour like in the DAC reminder
- Applications that have already been processed before this feature is introduced don't have expiration dates. How to handle these?
- Add an API endpoint for finding old processed applications.
- Add an API endpoint for deleting old processed applications? Or setting an expiration date?
- This would enable running a script to set expiration dates for existing applications.
Open questions:
- What to do with automatically approved applications
- There could be a config that will force delete applications that don't have expiration data, alternatively a script can be made that goes through these and sets them in soft delete.
- Who should have access to the delete endpoint?
- Should grace period time be configurable?
- Access rights end date vs expire date – same or different?
Plan:
- [ ] allow /api/applications/delete (a command that deletes a single application) for all applications
- only to owner, or perhaps to a new separate role (`system`?)
- [ ] add deletion of application to end of end-to-end test
- [ ] config option to enable deletion (disabled by default)
- use similar formatting as with drafts :application-expiration {:application.state/draft {:delete-after "P30D" :reminder-before "P2D"}}
- [ ] soft delete first (`deleted_at` column in tables)
- [ ] background "poller" job to delete for real (default: after 90 days)
--
- [ ] (possibly implemented later) create example python script that fetches all applications via the API and deletes all that are over x days old
Contributor guide
Assessment
This issue has not been assessed yet.