debian-mirror-gitlab/app/services/work_items/widgets/base_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
497 B
Ruby
Raw Normal View History

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