Class: Gitlab::ImportExport::Group::GroupRestorer

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/import_export/group/group_restorer.rb

Instance Method Summary collapse

Constructor Details

#initialize(user:, shared:, group:, attributes:, importable_path:, relation_reader:, reader:) ⇒ GroupRestorer

Returns a new instance of GroupRestorer.


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/import_export/group/group_restorer.rb', line 7

def initialize(
  user:,
  shared:,
  group:,
  attributes:,
  importable_path:,
  relation_reader:,
  reader:
)
  @user = user
  @shared = shared
  @group = group
  @group_attributes = attributes
  @importable_path = importable_path
  @relation_reader = relation_reader
  @reader = reader
end

Instance Method Details

#restoreObject


25
26
27
28
29
30
31
32
33
34
# File 'lib/gitlab/import_export/group/group_restorer.rb', line 25

def restore
  # consume_relation returns a list of [relation, index]
  @group_members = @relation_reader
    .consume_relation(@importable_path, 'members')
    .map(&:first)

  return unless members_mapper.map

  restorer.restore
end