Class: IncidentManagement::TimelineEventTags::BaseService

Inherits:
Object
  • Object
show all
Defined in:
app/services/incident_management/timeline_event_tags/base_service.rb

Direct Known Subclasses

CreateService

Instance Method Summary collapse

Instance Method Details

#allowed?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 6

def allowed?
  user&.can?(:admin_incident_management_timeline_event_tag, project)
end

#error(message) ⇒ Object



14
15
16
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 14

def error(message)
  ServiceResponse.error(message: message)
end

#error_in_save(timeline_event_tag) ⇒ Object



22
23
24
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 22

def error_in_save(timeline_event_tag)
  error(timeline_event_tag.errors.full_messages.to_sentence)
end

#error_no_permissionsObject



18
19
20
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 18

def error_no_permissions
  error(_('You have insufficient permissions to manage timeline event tags for this project'))
end

#success(timeline_event_tag) ⇒ Object



10
11
12
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 10

def success(timeline_event_tag)
  ServiceResponse.success(payload: { timeline_event_tag: timeline_event_tag })
end