Skip to content

Paid namespace members can delete their own user record without delay

Eugie Limpin requested to merge el-delete-paid-users-immediately into master

What does this MR do and why?

Resolves https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/385

This MR adds an exception to users under paid namespaces (excluding trials) for delayed own-user account deletion introduced by https://gitlab.com/gitlab-org/gitlab/-/issues/409025+.

With the changes in this MR, there will be no 7-day delay when a user under a paid namespace deletes their own account.

How to set up and validate locally

  1. Start GDK in SAAS mode (GITLAB_SIMULATE_SAAS=1 gdk start)
  2. Turn on the feature flag
    $ rails console
    > Feature.enable(:delay_delete_own_user)
  3. Create a new user (user_a) and a group (paid_group)
  4. Create an ultimate plan subscription for the new group
    $ rails console
    > GitlabSubscription.find_by(namespace_id: <paid_group.id>).destroy # delete existing subscription if there is one
    > FactoryBot.create(:gitlab_subscription, :ultimate, namespace: Group.find(<paid_group.id>))
  5. Create another new user (user_b) to delete
  6. Login with user_a then add user_b to the group as a Reporter/Developer/Maintainer (as long as role is not Guest)
  7. Login with user_b, go to http://localhost:3000/-/profile/account then delete the account
  8. Validate that user_b is deleted a few minutes later instead after 7 days
   > User.find(<user_a.id>)
   => nil

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eugie Limpin

Merge request reports