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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c88f66e5
Commit
c88f66e5
authored
May 02, 2018
by
Jacob Schatz
Committed by
Micaël Bergeron
Jun 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update with more efficent looping.
parent
0316ea13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
15 deletions
+8
-15
lib/pseudonymity/table.rb
lib/pseudonymity/table.rb
+8
-13
lib/tasks/gitlab/db.rake
lib/tasks/gitlab/db.rake
+0
-2
No files found.
lib/pseudonymity/table.rb
View file @
c88f66e5
...
...
@@ -9,21 +9,16 @@ module Pseudonymity
end
def
anonymize
(
results
)
count
=
0
results
.
each
do
|
r
|
break
if
count
>
0
count
+=
1
puts
r
.
inspect
puts
@anon_fields
new_hash
=
r
.
each_with_object
({})
do
|
(
k
,
v
),
h
|
if
@anon_fields
.
include?
k
and
!
v
.
nil?
h
[
k
]
=
Digest
::
SHA2
.
new
(
256
).
hexdigest
v
else
h
[
k
]
=
v
end
columns
=
results
.
columns
# Assume they all have the same table
to_filter
=
@anon_fields
&
columns
results
.
each
do
|
result
|
to_filter
.
each
do
|
field
|
result
[
field
]
=
Digest
::
SHA2
.
new
(
256
).
hexdigest
(
result
[
field
])
unless
result
[
field
].
nil?
end
new_hash
end
results
end
end
...
...
lib/tasks/gitlab/db.rake
View file @
c88f66e5
...
...
@@ -73,8 +73,6 @@ namespace :gitlab do
desc
'Output pseudonymity dump of selected table'
task
:pseudonymity_dump
=>
:environment
do
table
=
Pseudonymity
::
Table
.
new
# REMOVE PRODUCTION INFRA SCRIPT AS PART OF MR>
puts
table
.
tables_to_csv
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