Commit dabad744 authored by James Lopez's avatar James Lopez

Merge branch '262094-fix-group-repository-analytics' into 'master'

Disallow guest access for group repository analytics

See merge request gitlab-org/gitlab!44721
parents 57cdcf33 0525692d
......@@ -140,7 +140,7 @@ module EE
rule { has_access & group_activity_analytics_available }
.enable :read_group_activity_analytics
rule { has_access & group_repository_analytics_available }
rule { reporter & group_repository_analytics_available }
.enable :read_group_repository_analytics
rule { reporter & group_merge_request_analytics_available }
......
---
title: Disallow guest access for group repository analytics
merge_request: 44721
author:
type: fixed
......@@ -17,7 +17,7 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
subject { get :show, params: { group_id: group } }
before do
group.add_guest(current_user)
group.add_reporter(current_user)
end
specify { is_expected.to have_gitlab_http_status(:success) }
......
......@@ -199,17 +199,25 @@ RSpec.describe GroupPolicy do
end
context 'when group repository analytics is available' do
let(:current_user) { guest }
before do
stub_licensed_features(group_repository_analytics: true)
end
context 'for guests' do
let(:current_user) { guest }
it { is_expected.not_to be_allowed(:read_group_repository_analytics) }
end
context 'for reporter+' do
let(:current_user) { reporter }
it { is_expected.to be_allowed(:read_group_repository_analytics) }
end
end
context 'when group repository analytics is not available' do
let(:current_user) { guest }
let(:current_user) { admin }
before do
stub_licensed_features(group_repository_analytics: false)
......
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