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 ...@@ -17,6 +17,7 @@ class License < ApplicationRecord
description_diffs description_diffs
elastic_search elastic_search
export_issues export_issues
group_activity_analytics
group_bulk_edit group_bulk_edit
group_burndown_charts group_burndown_charts
group_webhooks group_webhooks
......
...@@ -18,6 +18,10 @@ module EE ...@@ -18,6 +18,10 @@ module EE
@subject.feature_available?(:cycle_analytics_for_groups) @subject.feature_available?(:cycle_analytics_for_groups)
end end
condition(:group_activity_analytics_available) do
@subject.feature_available?(:group_activity_analytics)
end
condition(:can_owners_manage_ldap, scope: :global) do condition(:can_owners_manage_ldap, scope: :global) do
::Gitlab::CurrentSettings.allow_group_owners_to_manage_ldap? ::Gitlab::CurrentSettings.allow_group_owners_to_manage_ldap?
end end
...@@ -78,6 +82,9 @@ module EE ...@@ -78,6 +82,9 @@ module EE
rule { has_access & contribution_analytics_available } rule { has_access & contribution_analytics_available }
.enable :read_group_contribution_analytics .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 rule { reporter & cycle_analytics_available }.policy do
enable :read_group_cycle_analytics, :create_group_stage, :read_group_stage, :update_group_stage, :delete_group_stage enable :read_group_cycle_analytics, :create_group_stage, :read_group_stage, :update_group_stage, :delete_group_stage
end end
......
...@@ -88,6 +88,26 @@ describe GroupPolicy do ...@@ -88,6 +88,26 @@ describe GroupPolicy do
it { is_expected.not_to be_allowed(:read_group_contribution_analytics) } it { is_expected.not_to be_allowed(:read_group_contribution_analytics) }
end 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 context 'when timelogs report feature is enabled' do
before do before do
stub_licensed_features(group_timelogs: true) 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