Commit 49f860a9 authored by Fatih Acet's avatar Fatih Acet

Merge branch '12250-fix-permissions-for-dependency-list-project-sidebar-visibility' into 'master'

Show dependency-list-link in project sidebar based on permissions

See merge request gitlab-org/gitlab-ee!15066
parents 9fcfffa6 bb54ab87
...@@ -40,6 +40,10 @@ module EE ...@@ -40,6 +40,10 @@ module EE
nav_tabs << :security nav_tabs << :security
end end
if can?(current_user, :read_dependencies, @project)
nav_tabs << :dependencies
end
if ::Gitlab.config.packages.enabled && if ::Gitlab.config.packages.enabled &&
project.feature_available?(:packages) && project.feature_available?(:packages) &&
can?(current_user, :read_package, project) can?(current_user, :read_package, project)
......
- if project_nav_tab?(:security) - return unless project_nav_tab?(:security) || project_nav_tab?(:dependencies)
= nav_link(path: sidebar_security_paths) do
= link_to project_security_dashboard_path(@project), data: { qa_selector: 'link_security_dashboard' } do
.nav-icon-container
= sprite_icon('shield')
%span.nav-item-name
= _('Security & Compliance')
%ul.sidebar-sub-level-items - top_level_link = project_nav_tab?(:security) ? project_security_dashboard_path(@project) : project_dependencies_path(@project)
= nav_link(path: sidebar_security_paths, html_options: { class: "fly-out-top-item" } ) do - top_level_qa_selector = project_nav_tab?(:security) ? 'security_dashboard_link' : 'dependency_list_link'
= link_to project_security_dashboard_path(@project) do
%strong.fly-out-top-item-name
= _('Security & Compliance')
%li.divider.fly-out-top-item
= nav_link(path: sidebar_security_paths) do
= link_to top_level_link, data: { qa_selector: top_level_qa_selector } do
.nav-icon-container
= sprite_icon('shield')
%span.nav-item-name
= _('Security & Compliance')
%ul.sidebar-sub-level-items
= nav_link(path: sidebar_security_paths, html_options: { class: "fly-out-top-item" } ) do
= link_to top_level_link do
%strong.fly-out-top-item-name
= _('Security & Compliance')
%li.divider.fly-out-top-item
- if project_nav_tab?(:security)
= nav_link(path: 'projects/security/dashboard#show') do = nav_link(path: 'projects/security/dashboard#show') do
= link_to project_security_dashboard_path(@project), title: _('Security Dashboard') do = link_to project_security_dashboard_path(@project), title: _('Security Dashboard') do
%span= _('Security Dashboard') %span= _('Security Dashboard')
- if @project.feature_available?(:dependency_list) - if project_nav_tab?(:dependencies)
= nav_link(path: 'projects/dependencies#show') do = nav_link(path: 'projects/dependencies#show') do
= link_to project_dependencies_path(@project), title: _('Dependency List'), data: { qa_selector: 'dependency_list_link' } do = link_to project_dependencies_path(@project), title: _('Dependency List'), data: { qa_selector: 'dependency_list_link' } do
%span= _('Dependency List') %span= _('Dependency List')
---
title: Fix visibility of link to dependency-list in project sidebar based on permissions
merge_request: 15066
author:
type: fixed
...@@ -11,7 +11,7 @@ module QA ...@@ -11,7 +11,7 @@ module QA
def self.included(page) def self.included(page)
page.class_eval do page.class_eval do
view 'ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml' do view 'ee/app/views/layouts/nav/sidebar/_project_security_link.html.haml' do
element :link_security_dashboard element :security_dashboard_link
element :dependency_list_link element :dependency_list_link
end end
end end
...@@ -19,7 +19,7 @@ module QA ...@@ -19,7 +19,7 @@ module QA
def click_on_security_dashboard def click_on_security_dashboard
within_sidebar do within_sidebar do
click_element :link_security_dashboard click_element :security_dashboard_link
end end
end end
...@@ -33,7 +33,7 @@ module QA ...@@ -33,7 +33,7 @@ module QA
def hover_security_compliance def hover_security_compliance
within_sidebar do within_sidebar do
find_element(:link_security_dashboard).hover find_element(:security_dashboard_link).hover
yield yield
end end
......
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