BigW Consortium Gitlab

build_action_entity.rb 430 Bytes
Newer Older
1
class BuildActionEntity < Grape::Entity
2 3 4
  include RequestAwareEntity

  expose :name do |build|
5
    build.name
6 7
  end

8
  expose :path do |build|
9
    play_namespace_project_job_path(
10 11
      build.project.namespace,
      build.project,
12 13
      build)
  end
14 15

  expose :playable?, as: :playable
16 17 18 19 20 21

  private

  alias_method :build, :object

  def playable?
22
    build.playable? && can?(request.current_user, :update_build, build)
23
  end
24
end