gitlab-org--gitlab-foss/app/serializers/runner_entity.rb

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

24 lines
451 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class RunnerEntity < Grape::Entity
include RequestAwareEntity
expose :id, :description, :short_sha
expose :edit_path, if: -> (*) { can_edit_runner? } do |runner|
edit_project_runner_path(project, runner)
end
private
2017-05-29 03:58:20 -04:00
alias_method :runner, :object
def project
request.project
end
def can_edit_runner?
can?(request.current_user, :update_runner, runner) && runner.project_type?
end
end