Class: Groups::ImportExport::ExportService

Inherits:
Object
  • Object
show all
Defined in:
app/services/groups/import_export/export_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(group:, user:, exported_by_admin:, params: {}) ⇒ ExportService

Returns a new instance of ExportService.



6
7
8
9
10
11
12
13
# File 'app/services/groups/import_export/export_service.rb', line 6

def initialize(group:, user:, exported_by_admin:, params: {})
  @group = group
  @current_user = user
  @exported_by_admin = exported_by_admin
  @params = params
  @shared = @params[:shared] || Gitlab::ImportExport::Shared.new(@group)
  @logger = Gitlab::Export::Logger.build
end

Instance Method Details

#async_executeObject



15
16
17
18
19
20
21
# File 'app/services/groups/import_export/export_service.rb', line 15

def async_execute
  GroupExportWorker.perform_async(
    current_user.id,
    group.id,
    params.merge(exported_by_admin: @exported_by_admin)
  )
end

#executeObject



23
24
25
26
27
28
29
30
31
# File 'app/services/groups/import_export/export_service.rb', line 23

def execute
  validate_user_permissions

  remove_existing_export! if group.export_file_exists?(current_user)

  save!
ensure
  remove_archive_tmp_dir
end