Commit d51e8e1b authored by Grzegorz Bizon's avatar Grzegorz Bizon

Inherit build badge access permissions from project

parent 7e1453f2
......@@ -4,10 +4,6 @@ class Projects::BuildsController < Projects::ApplicationController
before_action :authorize_update_build!, except: [:index, :show, :status]
layout 'project'
# Skip authentication for status badge only
skip_before_action :authenticate_user!, :reject_blocked!, :project,
:repository, :authorize_manage_builds!, :build, only: [:badge]
def index
@scope = params[:scope]
@all_builds = project.builds
......@@ -51,18 +47,16 @@ def retry
redirect_to build_path(build)
def status
render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha)
def cancel
redirect_to build_path(@build)
def badge
project = Project.find_with_namespace("#{params[:namespace_id]}/#{params[:project_id]}")
def status
render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha)
def badge
respond_to do |format|
format.html { render_404 }
format.svg do
......@@ -192,8 +192,6 @@ You can access a builds badge image using following link:
Build badge is available for everyone, even if your project is private or internal.
## Next steps
Awesome! You started using CI in GitLab!
Feature: Project Builds Badge
Given project exists in some group namespace
Given I sign in as a user
And I own a project
And project has CI enabled
And project has a recent build
class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedBuilds
include RepoHelpers
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment