summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-05-23 00:41:50 +0000
committerRobert Speicher <rspeicher@gmail.com>2016-05-22 20:43:16 -0400
commitdbdeccdd96613180b11db82daf66d4e955e8537e (patch)
treef0e9e1ca269e9fc6a7ab0366b7cf72dd5e40d4f0 /app
parentc2911ca42cf934ab14a1c71098a4a401b2bbde61 (diff)
downloadgitlab-ce-dbdeccdd96613180b11db82daf66d4e955e8537e.tar.gz
Merge branch 'fix-access-to-pipelines-for-anonymous' into 'master'
Allow anonymous user to access pipelines ## What does this MR do? It fixes an issue where the Pipelines is shown for the Anonymous users, but they get 404 when clicked. Their session is then logged out. Fixes #17717. See merge request !4233
Diffstat (limited to 'app')
-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
3 files changed, 7 insertions, 1 deletions
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')