Commit 553fff95 authored by Mark Chao's avatar Mark Chao

Add policy for managing subscriptions

parent 1622ac99
......@@ -28,6 +28,7 @@ module EE
enable :destroy_licenses
enable :read_all_geo
enable :manage_devops_adoption_segments
enable :manage_subscription
end
rule { admin & pages_size_limit_available }.enable :update_max_pages_size
......
......@@ -39,17 +39,20 @@ RSpec.describe GlobalPolicy do
it { is_expected.to be_disallowed(:read_licenses) }
it { is_expected.to be_disallowed(:destroy_licenses) }
it { is_expected.to be_disallowed(:read_all_geo) }
it { is_expected.to be_disallowed(:manage_subscription) }
context 'when admin mode enabled', :enable_admin_mode do
it { expect(described_class.new(admin, [user])).to be_allowed(:read_licenses) }
it { expect(described_class.new(admin, [user])).to be_allowed(:destroy_licenses) }
it { expect(described_class.new(admin, [user])).to be_allowed(:read_all_geo) }
it { expect(described_class.new(admin, [user])).to be_allowed(:manage_subscription) }
end
context 'when admin mode disabled' do
it { expect(described_class.new(admin, [user])).to be_disallowed(:read_licenses) }
it { expect(described_class.new(admin, [user])).to be_disallowed(:destroy_licenses) }
it { expect(described_class.new(admin, [user])).to be_disallowed(:read_all_geo) }
it { expect(described_class.new(admin, [user])).to be_disallowed(:manage_subscription) }
end
shared_examples 'analytics policy' do |action|
......
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