Commit be19f7d0 authored by Alex Kalderimis's avatar Alex Kalderimis Committed by Robert Speicher

Apply the feature flag

parent 44b27b51
......@@ -123,6 +123,11 @@ class ProjectPolicy < BasePolicy
!@subject.design_management_enabled?
end
with_scope :global
condition(:moving_designs_disabled) do
!::Feature.enabled?(:reorder_designs)
end
with_scope :subject
condition(:service_desk_enabled) { @subject.service_desk_enabled? }
......@@ -577,6 +582,10 @@ class ProjectPolicy < BasePolicy
prevent :move_design
end
rule { moving_designs_disabled }.policy do
prevent :move_design
end
rule { read_package_registry_deploy_token }.policy do
enable :read_package
enable :read_project
......
......@@ -131,6 +131,17 @@ RSpec.describe DesignManagement::DesignPolicy do
it_behaves_like "design abilities available for members"
context 'when reorder_designs is not enabled' do
before do
stub_feature_flags(reorder_designs: false)
end
let(:current_user) { developer }
it { is_expected.to be_allowed(*(developer_design_abilities - [:move_design])) }
it { is_expected.to be_disallowed(:move_design) }
end
context "for guests in private projects" do
let_it_be(:project) { create(:project, :private) }
let(:current_user) { guest }
......
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