Auto-delete projects of banned users after 60 days
What does this MR do and why?
Related to https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/702
This MR adds workers that automatically delete projects created and owned by banned users after a 60-day waiting period.
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.
- Enable the feature flag
Feature.enable(:delete_banned_user_projects) - Create a user.
- With the user create a project.
- Invite the user as an owner of a project the user did not create.
- Ban the user
- Monitor the sidekiq and application logs
tail -f log/sidekiq.log | grep BannedUserProjectDeletion tail -f log/application_json.log | grep BannedUserProjectDeletion - Trigger the
AntiAbuse::BannedUserProjectDeletionCronWorkerAntiAbuse::BannedUserProjectDeletionCronWorker.new.perform - Nothing should have happened since the user has not been banned for 60 days. Update the
created_attimestamp of the banned user and re-trigger the worker. You should now see logs emitted related to the project deletion and the project created by the banned user should be destroyed.Users::BannedUser.last.update!(created_at: 61.days.ago) AntiAbuse::BannedUserProjectDeletionCronWorker.new.perform
Edited by Ian Anderson