Commit 1f085d7e authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch 'ag-add-group-policy-for-group-activity' into 'master'

Add policy for Group Activity Analytics feature

See merge request gitlab-org/gitlab!26458
parents 0bfc044f 97532bc2
......@@ -17,6 +17,7 @@ class License < ApplicationRecord
description_diffs
elastic_search
export_issues
group_activity_analytics
group_bulk_edit
group_burndown_charts
group_webhooks
......
......@@ -18,6 +18,10 @@ module EE
@subject.feature_available?(:cycle_analytics_for_groups)
end
condition(:group_activity_analytics_available) do
@subject.feature_available?(:group_activity_analytics)
end
condition(:can_owners_manage_ldap, scope: :global) do
::Gitlab::CurrentSettings.allow_group_owners_to_manage_ldap?
end
......@@ -78,6 +82,9 @@ module EE
rule { has_access & contribution_analytics_available }
.enable :read_group_contribution_analytics
rule { can?(:read_group) & group_activity_analytics_available }
.enable :read_group_activity_analytics
rule { reporter & cycle_analytics_available }.policy do
enable :read_group_cycle_analytics, :create_group_stage, :read_group_stage, :update_group_stage, :delete_group_stage
end
......
......@@ -88,6 +88,26 @@ describe GroupPolicy do
it { is_expected.not_to be_allowed(:read_group_contribution_analytics) }
end
context 'when group activity analytics is available' do
let(:current_user) { developer }
before do
stub_licensed_features(group_activity_analytics: true)
end
it { is_expected.to be_allowed(:read_group_activity_analytics) }
end
context 'when group activity analytics is not available' do
let(:current_user) { developer }
before do
stub_licensed_features(group_activity_analytics: false)
end
it { is_expected.not_to be_allowed(:read_group_activity_analytics) }
end
context 'when timelogs report feature is enabled' do
before do
stub_licensed_features(group_timelogs: true)
......
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