Class: Packages::MarkPackageForDestructionService

Inherits:
BaseContainerService show all
Defined in:
app/services/packages/mark_package_for_destruction_service.rb

Instance Attribute Summary

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #initialize, #namespace_container?, #project_container?, #project_group

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseContainerService

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/packages/mark_package_for_destruction_service.rb', line 7

def execute
  return service_response_error("You don't have access to this package", 403) unless user_can_delete_package?

  package.pending_destruction!

  package.mark_package_files_for_destruction
  package.(current_user)

  service_response_success('Package was successfully marked as pending destruction')
rescue StandardError => e
  track_exception(e)
  service_response_error('Failed to mark the package as pending destruction', 400)
end