diff options
author | James Lopez <james@jameslopez.es> | 2017-01-30 12:26:49 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-01-30 12:34:32 +0100 |
commit | 1a2d13c821179a2707790d9c0e4585044462cd42 (patch) | |
tree | 45b3044bf8b7d76a757131c5260ed1cb107b6808 /lib/gitlab/import_export | |
parent | eeb13c16d1f627eba10313bf5c4662416392feb3 (diff) | |
download | gitlab-ce-1a2d13c821179a2707790d9c0e4585044462cd42.tar.gz |
programmatically remove encrypted attributes. Added relevant spec.
Diffstat (limited to 'lib/gitlab/import_export')
-rw-r--r-- | lib/gitlab/import_export/relation_factory.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index cb9f20a70a0..dd7f9e2fd65 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -63,6 +63,7 @@ module Gitlab handle_group_label if group_label? reset_tokens! + remove_encrypted_attributes! @relation_hash['data'].deep_symbolize_keys! if @relation_name == :events && @relation_hash['data'] set_st_diffs if @relation_name == :merge_request_diff @@ -152,6 +153,14 @@ module Gitlab end end + def remove_encrypted_attributes! + return if relation_class.encrypted_attributes.empty? + + relation_class.encrypted_attributes.each_key do |key| + @relation_hash[key.to_s] = nil + end + end + def relation_class @relation_class ||= @relation_name.to_s.classify.constantize end |