Class: WorkItems::DeleteService

Inherits:
Issuable::DestroyService show all
Defined in:
app/services/work_items/delete_service.rb

Instance Attribute Summary

Attributes inherited from BaseContainerService

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

Instance Method Summary collapse

Methods inherited from Issuable::DestroyService

#initialize

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 Issuable::DestroyService

Instance Method Details

#execute(work_item) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/services/work_items/delete_service.rb', line 5

def execute(work_item)
  unless current_user.can?(:delete_work_item, work_item)
    return ::ServiceResponse.error(message: 'User not authorized to delete work item')
  end

  if super
    ::ServiceResponse.success
  else
    ::ServiceResponse.error(message: work_item.errors.full_messages)
  end
end