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:, params: {}) ⇒ ExportService

Returns a new instance of ExportService.


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

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

Instance Method Details

#async_executeObject


14
15
16
# File 'app/services/groups/import_export/export_service.rb', line 14

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

#executeObject


18
19
20
21
22
23
24
25
26
# File 'app/services/groups/import_export/export_service.rb', line 18

def execute
  validate_user_permissions

  remove_existing_export! if @group.export_file_exists?

  save!
ensure
  remove_base_tmp_dir
end