Inherit build badge access permissions from project
This commit is contained in:
parent
7e1453f2f0
commit
d51e8e1b77
4 changed files with 7 additions and 13 deletions
|
@ -4,10 +4,6 @@ class Projects::BuildsController < Projects::ApplicationController
|
||||||
before_action :authorize_update_build!, except: [:index, :show, :status]
|
before_action :authorize_update_build!, except: [:index, :show, :status]
|
||||||
layout 'project'
|
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
|
def index
|
||||||
@scope = params[:scope]
|
@scope = params[:scope]
|
||||||
@all_builds = project.builds
|
@all_builds = project.builds
|
||||||
|
@ -51,18 +47,16 @@ class Projects::BuildsController < Projects::ApplicationController
|
||||||
redirect_to build_path(build)
|
redirect_to build_path(build)
|
||||||
end
|
end
|
||||||
|
|
||||||
def status
|
|
||||||
render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha)
|
|
||||||
end
|
|
||||||
|
|
||||||
def cancel
|
def cancel
|
||||||
@build.cancel
|
@build.cancel
|
||||||
redirect_to build_path(@build)
|
redirect_to build_path(@build)
|
||||||
end
|
end
|
||||||
|
|
||||||
def badge
|
def status
|
||||||
project = Project.find_with_namespace("#{params[:namespace_id]}/#{params[:project_id]}")
|
render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha)
|
||||||
|
end
|
||||||
|
|
||||||
|
def badge
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render_404 }
|
format.html { render_404 }
|
||||||
format.svg do
|
format.svg do
|
||||||
|
|
|
@ -192,8 +192,6 @@ You can access a builds badge image using following link:
|
||||||
http://example.gitlab.com/namespace/project/builds/status/branch/badge.svg
|
http://example.gitlab.com/namespace/project/builds/status/branch/badge.svg
|
||||||
```
|
```
|
||||||
|
|
||||||
Build badge is available for everyone, even if your project is private or internal.
|
|
||||||
|
|
||||||
## Next steps
|
## Next steps
|
||||||
|
|
||||||
Awesome! You started using CI in GitLab!
|
Awesome! You started using CI in GitLab!
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
Feature: Project Builds Badge
|
Feature: Project Builds Badge
|
||||||
Background:
|
Background:
|
||||||
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 CI enabled
|
||||||
And project has a recent build
|
And project has a recent build
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
|
class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
|
||||||
|
include SharedAuthentication
|
||||||
include SharedProject
|
include SharedProject
|
||||||
include SharedBuilds
|
include SharedBuilds
|
||||||
include RepoHelpers
|
include RepoHelpers
|
||||||
|
|
Loading…
Reference in a new issue