debian-mirror-gitlab/app/serializers/runner_entity.rb

24 lines
439 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
class RunnerEntity < Grape::Entity
include RequestAwareEntity
expose :id, :description
2018-12-05 23:21:45 +05:30
expose :edit_path, if: -> (*) { can_edit_runner? } do |runner|
2017-09-10 17:25:29 +05:30
edit_project_runner_path(project, runner)
end
private
alias_method :runner, :object
def project
request.project
end
2018-12-05 23:21:45 +05:30
def can_edit_runner?
can?(request.current_user, :update_runner, runner) && runner.project_type?
end
2017-09-10 17:25:29 +05:30
end