2022-08-13 15:12:31 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module WorkItems
|
|
|
|
module Widgets
|
|
|
|
class BaseService < ::BaseService
|
|
|
|
WidgetError = Class.new(StandardError)
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
attr_reader :widget, :work_item, :current_user
|
2022-08-13 15:12:31 +05:30
|
|
|
|
|
|
|
def initialize(widget:, current_user:)
|
|
|
|
@widget = widget
|
2022-08-27 11:52:29 +05:30
|
|
|
@work_item = widget.work_item
|
2022-08-13 15:12:31 +05:30
|
|
|
@current_user = current_user
|
|
|
|
end
|
2022-08-27 11:52:29 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def has_permission?(permission)
|
|
|
|
can?(current_user, permission, widget.work_item)
|
|
|
|
end
|
2022-08-13 15:12:31 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|