Commit 49870c19 authored by Michael Kozono's avatar Michael Kozono

Merge branch...

Merge branch '348480-admins-should-be-able-to-set-the-new-user-sign-up-cap-at-a-value-higher-than-the-licensed' into 'master'

Resolve "Admins should be able to set the new user sign up cap at a value higher than the licensed user count"

See merge request gitlab-org/gitlab!76829
parents dda0cd59 75a71bc0
...@@ -109,8 +109,7 @@ module EE ...@@ -109,8 +109,7 @@ module EE
allow_blank: true, allow_blank: true,
numericality: { numericality: {
only_integer: true, only_integer: true,
greater_than: 0, greater_than: 0
less_than_or_equal_to: proc { License.current&.restricted_user_count }
}, },
if: proc { License.current&.restricted_user_count? } if: proc { License.current&.restricted_user_count? }
......
...@@ -291,26 +291,6 @@ RSpec.describe 'Admin updates EE-only settings' do ...@@ -291,26 +291,6 @@ RSpec.describe 'Admin updates EE-only settings' do
visit general_admin_application_settings_path visit general_admin_application_settings_path
end end
context 'when license has active user count' do
let(:license) { create(:license, restrictions: { active_user_count: 1 }) }
before do
allow(License).to receive(:current).and_return(license)
end
it 'disallows entering user cap greater then license allows' do
page.within('#js-signup-settings') do
fill_in 'application_setting[new_user_signups_cap]', with: 5
click_button 'Save changes'
page.within '#error_explanation' do
expect(page).to have_text('New user signups cap must be less than or equal to 1')
end
end
end
end
it 'changes the user cap from unlimited to 5' do it 'changes the user cap from unlimited to 5' do
expect(current_settings.new_user_signups_cap).to be_nil expect(current_settings.new_user_signups_cap).to be_nil
......
...@@ -172,19 +172,6 @@ RSpec.describe ApplicationSetting do ...@@ -172,19 +172,6 @@ RSpec.describe ApplicationSetting do
end end
end end
context 'when license presented' do
let_it_be(:max_active_user_count) { 20 }
before_all do
create_current_license({ restrictions: { active_user_count: max_active_user_count } })
end
it { is_expected.to allow_value(max_active_user_count - 1).for(:new_user_signups_cap) }
it { is_expected.to allow_value(max_active_user_count).for(:new_user_signups_cap) }
it { is_expected.to allow_value(nil).for(:new_user_signups_cap) }
it { is_expected.not_to allow_value(max_active_user_count + 1).for(:new_user_signups_cap) }
end
context 'Sentry validations' do context 'Sentry validations' do
context 'when Sentry is enabled' do context 'when Sentry is enabled' do
before do before do
......
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