Class: WorkItems::DataSync::BaseService

Inherits:
BaseContainerService show all
Includes:
Services::ReturnServiceResponses
Defined in:
app/services/work_items/data_sync/base_service.rb

Direct Known Subclasses

CloneService, MoveService

Instance Attribute Summary collapse

Attributes inherited from BaseContainerService

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

Instance Method Summary collapse

Methods included from Services::ReturnServiceResponses

#error, #success

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?, #project_group, #root_ancestor

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?, #can_all?, #can_any?

Constructor Details

#initialize(work_item:, target_namespace:, current_user: nil, params: {}) ⇒ BaseService

work_item - original work item target_namespace - ProjectNamespace, Group or Project current_user - user performing the move/clone action



13
14
15
16
17
18
# File 'app/services/work_items/data_sync/base_service.rb', line 13

def initialize(work_item:, target_namespace:, current_user: nil, params: {})
  @work_item = work_item
  @target_namespace = target_namespace

  super(container: work_item.namespace, current_user: current_user, params: params)
end

Instance Attribute Details

#service_responseObject (readonly)

Returns the value of attribute service_response.



8
9
10
# File 'app/services/work_items/data_sync/base_service.rb', line 8

def service_response
  @service_response
end

#target_namespaceObject (readonly)

Returns the value of attribute target_namespace.



8
9
10
# File 'app/services/work_items/data_sync/base_service.rb', line 8

def target_namespace
  @target_namespace
end

#work_itemObject (readonly)

Returns the value of attribute work_item.



8
9
10
# File 'app/services/work_items/data_sync/base_service.rb', line 8

def work_item
  @work_item
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
# File 'app/services/work_items/data_sync/base_service.rb', line 20

def execute
  verification_response = verify_work_item_action_permission

  return verification_response if verification_response.error?

  data_sync_action
end