Commit 543e1727 authored by Thong Kuah's avatar Thong Kuah

Merge branch '343661-make-ci-cd-analytics-visible-as-admin' into 'master'

Make DORA data visible for admins

See merge request gitlab-org/gitlab!76204
parents 1fb66ed6 c241e6dc
......@@ -185,7 +185,7 @@ module EE
rule { has_access & group_activity_analytics_available }
.enable :read_group_activity_analytics
rule { reporter & dora4_analytics_available }
rule { (admin | reporter) & dora4_analytics_available }
.enable :read_dora4_analytics
rule { reporter & group_repository_analytics_available }
......
......@@ -357,7 +357,7 @@ module EE
rule { can?(:read_merge_request) & code_review_analytics_enabled }.enable :read_code_review_analytics
rule { reporter & dora4_analytics_available }
rule { (admin | reporter) & dora4_analytics_available }
.enable :read_dora4_analytics
rule { reporter & project_merge_request_analytics_available }
......
......@@ -196,15 +196,23 @@ RSpec.describe GroupPolicy do
end
context 'when dora4 analytics is available' do
let(:current_user) { developer }
before do
stub_licensed_features(dora4_analytics: true)
end
context 'when the user is a developer' do
let(:current_user) { developer }
it { is_expected.to be_allowed(:read_dora4_analytics) }
end
context 'when the user is an admin', :enable_admin_mode do
let(:current_user) { admin }
it { is_expected.to be_allowed(:read_dora4_analytics) }
end
end
context 'when dora4 analytics is not available' do
let(:current_user) { developer }
......
......@@ -1286,14 +1286,22 @@ RSpec.describe ProjectPolicy do
end
context 'when dora4 analytics is available' do
let(:current_user) { developer }
before do
stub_licensed_features(dora4_analytics: true)
end
context 'when the user is a developer' do
let(:current_user) { developer }
it { is_expected.to be_allowed(:read_dora4_analytics) }
end
context 'when the user is an admin', :enable_admin_mode do
let(:current_user) { admin }
it { is_expected.to be_allowed(:read_dora4_analytics) }
end
end
context 'when dora4 analytics is not available' do
let(:current_user) { developer }
......
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