Commit e12074f0 authored by Michael Kozono's avatar Michael Kozono

Merge branch '202289-remove-security-dashboard-button-from-project-page' into 'master'

Remove Security Dashboard button from project page

Closes #202289

See merge request gitlab-org/gitlab!24781
parents 8c093cce ae1d1ae4
...@@ -10,26 +10,11 @@ module EE ...@@ -10,26 +10,11 @@ module EE
end end
def extra_statistics_buttons def extra_statistics_buttons
buttons = [] []
if can?(current_user, :read_project_security_dashboard, project)
buttons << security_dashboard_data
end
buttons
end end
def approver_groups def approver_groups
::ApproverGroup.filtered_approver_groups(project.approver_groups, current_user) ::ApproverGroup.filtered_approver_groups(project.approver_groups, current_user)
end end
private
def security_dashboard_data
OpenStruct.new(is_link: false,
label: statistic_icon('lock') + _('Security Dashboard'),
link: project_security_dashboard_index_path(project),
class_modifier: 'default')
end
end end
end end
---
title: Remove Security Dashboard button from project page
merge_request: 24781
author:
type: removed
...@@ -9,34 +9,8 @@ describe ProjectPresenter do ...@@ -9,34 +9,8 @@ describe ProjectPresenter do
describe '#extra_statistics_buttons' do describe '#extra_statistics_buttons' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:presenter) { described_class.new(project, current_user: user) } let(:presenter) { described_class.new(project, current_user: user) }
let(:security_dashboard_data) do it { expect(presenter.extra_statistics_buttons).to be_empty }
OpenStruct.new(is_link: false,
label: a_string_including('Security Dashboard'),
link: project_security_dashboard_index_path(project),
class_modifier: 'default')
end
context 'user is allowed to read security dashboard' do
before do
allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(true)
end
it 'has security dashboard link' do
expect(presenter.extra_statistics_buttons.find { |button| button[:link] == project_security_dashboard_index_path(project) }).not_to be_nil
end
end
context 'user is not allowed to read security dashboard' do
before do
allow(Ability).to receive(:allowed?).with(user, :read_project_security_dashboard, project).and_return(false)
end
it 'has no security dashboard link' do
expect(presenter.extra_statistics_buttons.find { |button| button[:link] == project_security_dashboard_index_path(project) }).to be_nil
end
end
end end
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