summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-21 17:58:11 -0500
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-05-23 01:31:51 +0200
commitcd26cfbc27218b734a1a78836084f2205a18c580 (patch)
tree6c0815e7aa535072a14754d95cfd946ec64ffee8
parent243e9bc0d9d34e3e930571713625bd51a09a08a6 (diff)
downloadgitlab-ce-cd26cfbc27218b734a1a78836084f2205a18c580.tar.gz
Allow anonymous user to access pipelines
-rw-r--r--CHANGELOG1
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/models/ability.rb1
-rw-r--r--app/views/layouts/nav/_project.html.haml3
-rw-r--r--spec/features/pipelines_spec.rb6
5 files changed, 14 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index ef4d72a9e9b..950002df8f2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,6 +25,7 @@ v 8.8.0 (unreleased)
- Updated gitlab_git to 10.1.0
- GitAccess#protected_tag? no longer loads all tags just to check if a single one exists
- Reduce delay in destroying a project from 1-minute to immediately
+ - Fix access to Pipelines by Anonymous user
- Make build status canceled if any of the jobs was canceled and none failed
- Upgrade Sidekiq to 4.1.2
- Added /health_check endpoint for checking service status
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 0825b5b6437..5e5d170a9f3 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -144,6 +144,10 @@ module ProjectsHelper
nav_tabs << :merge_requests
end
+ if can?(current_user, :read_pipeline, project)
+ nav_tabs << :pipelines
+ end
+
if can?(current_user, :read_build, project)
nav_tabs << :builds
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index f7ea2fd2b1f..b354b1990c7 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -60,6 +60,7 @@ class Ability
:read_project_member,
:read_merge_request,
:read_note,
+ :read_pipeline,
:read_commit_status,
:read_container_image,
:download_code
diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml
index a97fefcfb46..6dff488eda5 100644
--- a/app/views/layouts/nav/_project.html.haml
+++ b/app/views/layouts/nav/_project.html.haml
@@ -38,7 +38,7 @@
%span
Commits
- - if project_nav_tab? :builds
+ - if project_nav_tab? :pipelines
= nav_link(controller: :pipelines) do
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
= icon('ship fw')
@@ -46,6 +46,7 @@
Pipelines
%span.count.ci_counter= number_with_delimiter(@project.ci_commits.running_or_pending.count)
+ - if project_nav_tab? :builds
= nav_link(controller: %w(builds)) do
= link_to project_builds_path(@project), title: 'Builds', class: 'shortcuts-builds' do
= icon('cubes fw')
diff --git a/spec/features/pipelines_spec.rb b/spec/features/pipelines_spec.rb
index 32665aadd22..1d6f4485c81 100644
--- a/spec/features/pipelines_spec.rb
+++ b/spec/features/pipelines_spec.rb
@@ -24,6 +24,12 @@ describe "Pipelines" do
end
end
+ context 'anonymous access' do
+ before { visit namespace_project_pipelines_path(project.namespace, project) }
+
+ it { expect(page).to have_http_status(:success) }
+ end
+
context 'cancelable pipeline' do
let!(:running) { create(:ci_build, :running, commit: pipeline, stage: 'test', commands: 'test') }