diff options
Diffstat (limited to 'lib/bulk_imports/groups/pipelines/namespace_settings_pipeline.rb')
-rw-r--r-- | lib/bulk_imports/groups/pipelines/namespace_settings_pipeline.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/bulk_imports/groups/pipelines/namespace_settings_pipeline.rb b/lib/bulk_imports/groups/pipelines/namespace_settings_pipeline.rb new file mode 100644 index 00000000000..1bd6486b413 --- /dev/null +++ b/lib/bulk_imports/groups/pipelines/namespace_settings_pipeline.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module BulkImports + module Groups + module Pipelines + class NamespaceSettingsPipeline + include Pipeline + + file_extraction_pipeline! + + relation_name 'namespace_settings' + + extractor ::BulkImports::Common::Extractors::NdjsonExtractor, relation: relation + + transformer ::BulkImports::Common::Transformers::ProhibitedAttributesTransformer + + def transform(_context, data) + return unless data + + data.first.symbolize_keys.slice(*allowed_attributes) + end + + def load(_context, data) + return unless data + + ::Groups::UpdateService.new(portable, current_user, data).execute + end + + def after_run(_context) + extractor.remove_tmpdir + end + + private + + def allowed_attributes + Gitlab::ImportExport::Config.new( + config: Gitlab::ImportExport.group_config_file + ).to_h.dig(:included_attributes, :namespace_settings) + end + end + end + end +end |