Commit ae1d1ae4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove security dashboard button from project page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent e20c2574
......@@ -10,26 +10,11 @@ module EE
end
def extra_statistics_buttons
buttons = []
if can?(current_user, :read_project_security_dashboard, project)
buttons << security_dashboard_data
end
buttons
[]
end
def approver_groups
::ApproverGroup.filtered_approver_groups(project.approver_groups, current_user)
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
---
title: Remove Security Dashboard button from project page
merge_request: 24781
author:
type: removed
......@@ -9,34 +9,8 @@ describe ProjectPresenter do
describe '#extra_statistics_buttons' do
let(:project) { create(:project) }
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:presenter) { described_class.new(project, current_user: user) }
let(:security_dashboard_data) do
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
it { expect(presenter.extra_statistics_buttons).to be_empty }
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