Commit f9582e96 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'if-12457-fix_group_permission_save' into 'master'

Allow blank values for IP restriction setting form

See merge request gitlab-org/gitlab-ee!14427
parents f2828b7a fc55e63a
......@@ -19,7 +19,7 @@ module EE
has_one :saml_provider
has_one :ip_restriction
accepts_nested_attributes_for :ip_restriction, allow_destroy: true
accepts_nested_attributes_for :ip_restriction, allow_destroy: true, reject_if: :all_blank
has_one :insight, foreign_key: :namespace_id
accepts_nested_attributes_for :insight, allow_destroy: true
has_one :scim_oauth_access_token
......
---
title: Allow blank values for IP restriction setting
merge_request: 14427
author:
type: fixed
......@@ -102,6 +102,23 @@ describe GroupsController, type: :request do
end
end
context 'with empty ip restriction param' do
let(:params) do
{ group: { two_factor_grace_period: 42,
ip_restriction_attributes: { range: "" } } }
end
it 'updates group setting' do
expect { subject }
.to change { group.reload.two_factor_grace_period }.from(48).to(42)
expect(response).to have_gitlab_http_status(302)
end
it 'does not create ip restriction' do
expect { subject }.not_to change { IpRestriction.count }
end
end
context 'feature is disabled' do
before do
stub_licensed_features(group_ip_restriction: false)
......
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