summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-10-07 18:35:36 +0200
committerRémy Coutable <remy@rymai.me>2016-10-11 10:21:18 +0200
commitebba49149395ba6fb0f14c3aa9c46a496b234dea (patch)
treea058eedc37b8b6ec8b2a21273771ec2bbd0fe7fe /lib/tasks
parent73adae0f62a3d6048abbee9d076e077185370325 (diff)
downloadgitlab-ce-ebba49149395ba6fb0f14c3aa9c46a496b234dea.tar.gz
Add a new gitlab:users:clear_all_authentication_tokens task
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gitlab/users.rake11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/users.rake b/lib/tasks/gitlab/users.rake
new file mode 100644
index 00000000000..3a16ace60bd
--- /dev/null
+++ b/lib/tasks/gitlab/users.rake
@@ -0,0 +1,11 @@
+namespace :gitlab do
+ namespace :users do
+ desc "GitLab | Clear the authentication token for all users"
+ task clear_all_authentication_tokens: :environment do |t, args|
+ # Do small batched updates because these updates will be slow and locking
+ User.select(:id).find_in_batches(batch_size: 100) do |batch|
+ User.where(id: batch.map(&:id)).update_all(authentication_token: nil)
+ end
+ end
+ end
+end