Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
cd3b4ba4
Commit
cd3b4ba4
authored
Oct 12, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove gitlab:users:clear_all_authentication_tokens rake task
parent
fbdf0578
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
64 deletions
+0
-64
doc/raketasks/user_management.md
doc/raketasks/user_management.md
+0
-15
lib/tasks/gitlab/users.rake
lib/tasks/gitlab/users.rake
+0
-11
spec/tasks/gitlab/users_rake_spec.rb
spec/tasks/gitlab/users_rake_spec.rb
+0
-38
No files found.
doc/raketasks/user_management.md
View file @
cd3b4ba4
...
...
@@ -149,18 +149,3 @@ cp config/secrets.yml.bak config/secrets.yml
sudo /etc/init.d/gitlab start
```
## Clear authentication tokens for all users. Important! Data loss!
Clear authentication tokens for all users in the GitLab database. This
task is useful if your users' authentication tokens might have been exposed in
any way. All the existing tokens will become invalid, and new tokens are
automatically generated upon sign-in or user modification.
```
# omnibus-gitlab
sudo gitlab-rake gitlab:users:clear_all_authentication_tokens
# installation from source
bundle exec rake gitlab:users:clear_all_authentication_tokens RAILS_ENV=production
```
lib/tasks/gitlab/users.rake
deleted
100644 → 0
View file @
fbdf0578
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
spec/tasks/gitlab/users_rake_spec.rb
deleted
100644 → 0
View file @
fbdf0578
require
'spec_helper'
require
'rake'
describe
'gitlab:users namespace rake task'
do
let
(
:enable_registry
)
{
true
}
before
:all
do
Rake
.
application
.
rake_require
'tasks/gitlab/helpers'
Rake
.
application
.
rake_require
'tasks/gitlab/users'
# empty task as env is already loaded
Rake
::
Task
.
define_task
:environment
end
def
run_rake_task
(
task_name
)
Rake
::
Task
[
task_name
].
reenable
Rake
.
application
.
invoke_task
task_name
end
describe
'clear_all_authentication_tokens'
do
before
do
# avoid writing task output to spec progress
allow
(
$stdout
).
to
receive
:write
end
context
'gitlab version'
do
it
'clears the authentication token for all users'
do
create_list
(
:user
,
2
)
expect
(
User
.
pluck
(
:authentication_token
)).
to
all
(
be_present
)
run_rake_task
(
'gitlab:users:clear_all_authentication_tokens'
)
expect
(
User
.
pluck
(
:authentication_token
)).
to
all
(
be_nil
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment