Skip to content

Fix Admin Mode bug in DeactivateDormantUsersWorker

Cody West requested to merge codyw-fix-dormantuser-cron into master

What does this MR do and why?

This MR updates the DeactivateDormantUsersWorker Sidekiq cron job to skip authorization for the Users::DeactivateService. Without this, enabling admin mode will cause the DeactivateDormantUsersWorker sidekiq cron to silently fail.

Fixes: #431560 (closed)

How to set up and validate locally

  1. Be running at least GitLab 16.3.
  2. Enable Admin Mode
  3. Create a dormant user
  4. Manually execute the dormant workers cron from the Admin interface

To force a user to qualify for deactivation:

user = <id> # pick a user to make dormant and ready for deactivation
last_active = Gitlab::CurrentSettings.deactivate_dormant_users_period.days.ago.to_date - 1
user.last_activity_on = last_active
user.last_sign_in_at = last_active
user.current_sign_in_at = last_active

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 Josianne Hyson

Merge request reports