Commit 24a6292e authored by sfang97's avatar sfang97

Remove admin approval feature flag

Remove admin_approval_for_new_user_signups feature flag since it's
currently enabled by default and not causing customer problems.
parent a66d7fa5
...@@ -6,7 +6,6 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -6,7 +6,6 @@ class Admin::UsersController < Admin::ApplicationController
before_action :user, except: [:index, :new, :create] before_action :user, except: [:index, :new, :create]
before_action :check_impersonation_availability, only: :impersonate before_action :check_impersonation_availability, only: :impersonate
before_action :ensure_destroy_prerequisites_met, only: [:destroy] before_action :ensure_destroy_prerequisites_met, only: [:destroy]
before_action :check_admin_approval_feature_available!, only: [:approve]
feature_category :users feature_category :users
...@@ -298,10 +297,6 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -298,10 +297,6 @@ class Admin::UsersController < Admin::ApplicationController
def log_impersonation_event def log_impersonation_event
Gitlab::AppLogger.info(_("User %{current_user_username} has started impersonating %{username}") % { current_user_username: current_user.username, username: user.username }) Gitlab::AppLogger.info(_("User %{current_user_username} has started impersonating %{username}") % { current_user_username: current_user.username, username: user.username })
end end
def check_admin_approval_feature_available!
access_denied! unless Feature.enabled?(:admin_approval_for_new_user_signups, default_enabled: true)
end
end end
Admin::UsersController.prepend_if_ee('EE::Admin::UsersController') Admin::UsersController.prepend_if_ee('EE::Admin::UsersController')
...@@ -218,7 +218,6 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -218,7 +218,6 @@ class RegistrationsController < Devise::RegistrationsController
end end
def set_user_state def set_user_state
return unless Feature.enabled?(:admin_approval_for_new_user_signups, default_enabled: true)
return unless Gitlab::CurrentSettings.require_admin_approval_after_user_signup return unless Gitlab::CurrentSettings.require_admin_approval_after_user_signup
resource.state = BLOCKED_PENDING_APPROVAL_STATE resource.state = BLOCKED_PENDING_APPROVAL_STATE
......
...@@ -9,14 +9,13 @@ ...@@ -9,14 +9,13 @@
Sign-up enabled Sign-up enabled
.form-text.text-muted .form-text.text-muted
= _("When enabled, any user visiting %{host} will be able to create an account.") % { host: "#{new_user_session_url(host: Gitlab.config.gitlab.host)}" } = _("When enabled, any user visiting %{host} will be able to create an account.") % { host: "#{new_user_session_url(host: Gitlab.config.gitlab.host)}" }
- if Feature.enabled?(:admin_approval_for_new_user_signups, default_enabled: true) .form-group
.form-group .form-check
.form-check = f.check_box :require_admin_approval_after_user_signup, class: 'form-check-input'
= f.check_box :require_admin_approval_after_user_signup, class: 'form-check-input' = f.label :require_admin_approval_after_user_signup, class: 'form-check-label' do
= f.label :require_admin_approval_after_user_signup, class: 'form-check-label' do = _('Require admin approval for new sign-ups')
= _('Require admin approval for new sign-ups') .form-text.text-muted
.form-text.text-muted = _("When enabled, any user visiting %{host} and creating an account will have to be explicitly approved by an admin before they can sign in. This setting is effective only if sign-ups are enabled.") % { host: "#{new_user_session_url(host: Gitlab.config.gitlab.host)}" }
= _("When enabled, any user visiting %{host} and creating an account will have to be explicitly approved by an admin before they can sign in. This setting is effective only if sign-ups are enabled.") % { host: "#{new_user_session_url(host: Gitlab.config.gitlab.host)}" }
.form-group .form-group
.form-check .form-check
= f.check_box :send_user_confirmation_email, class: 'form-check-input' = f.check_box :send_user_confirmation_email, class: 'form-check-input'
......
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
= link_to admin_users_path(filter: "blocked") do = link_to admin_users_path(filter: "blocked") do
= s_('AdminUsers|Blocked') = s_('AdminUsers|Blocked')
%small.badge.badge-pill= limited_counter_with_delimiter(User.blocked) %small.badge.badge-pill= limited_counter_with_delimiter(User.blocked)
- if Feature.enabled?(:admin_approval_for_new_user_signups, default_enabled: true) = nav_link(html_options: { class: "#{active_when(params[:filter] == 'blocked_pending_approval')} filter-blocked-pending-approval" }) do
= nav_link(html_options: { class: "#{active_when(params[:filter] == 'blocked_pending_approval')} filter-blocked-pending-approval" }) do = link_to admin_users_path(filter: "blocked_pending_approval") do
= link_to admin_users_path(filter: "blocked_pending_approval") do = s_('AdminUsers|Pending approval')
= s_('AdminUsers|Pending approval') %small.badge.badge-pill= limited_counter_with_delimiter(User.blocked_pending_approval)
%small.badge.badge-pill= limited_counter_with_delimiter(User.blocked_pending_approval)
= nav_link(html_options: { class: active_when(params[:filter] == 'deactivated') }) do = nav_link(html_options: { class: active_when(params[:filter] == 'deactivated') }) do
= link_to admin_users_path(filter: "deactivated") do = link_to admin_users_path(filter: "deactivated") do
= s_('AdminUsers|Deactivated') = s_('AdminUsers|Deactivated')
......
...@@ -107,23 +107,7 @@ RSpec.describe Admin::UsersController do ...@@ -107,23 +107,7 @@ RSpec.describe Admin::UsersController do
subject { put :approve, params: { id: user.username } } subject { put :approve, params: { id: user.username } }
context 'when feature is disabled' do
before do
stub_feature_flags(admin_approval_for_new_user_signups: false)
end
it 'responds with access denied' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when feature is enabled' do context 'when feature is enabled' do
before do
stub_feature_flags(admin_approval_for_new_user_signups: true)
end
context 'when successful' do context 'when successful' do
it 'activates the user' do it 'activates the user' do
subject subject
......
...@@ -47,10 +47,6 @@ RSpec.describe RegistrationsController do ...@@ -47,10 +47,6 @@ RSpec.describe RegistrationsController do
context '`blocked_pending_approval` state' do context '`blocked_pending_approval` state' do
context 'when the feature is enabled' do context 'when the feature is enabled' do
before do
stub_feature_flags(admin_approval_for_new_user_signups: true)
end
context 'when the `require_admin_approval_after_user_signup` setting is turned on' do context 'when the `require_admin_approval_after_user_signup` setting is turned on' do
before do before do
stub_application_setting(require_admin_approval_after_user_signup: true) stub_application_setting(require_admin_approval_after_user_signup: true)
...@@ -127,10 +123,6 @@ RSpec.describe RegistrationsController do ...@@ -127,10 +123,6 @@ RSpec.describe RegistrationsController do
end end
context 'when the feature is disabled' do context 'when the feature is disabled' do
before do
stub_feature_flags(admin_approval_for_new_user_signups: false)
end
context 'when the `require_admin_approval_after_user_signup` setting is turned on' do context 'when the `require_admin_approval_after_user_signup` setting is turned on' do
before do before do
stub_application_setting(require_admin_approval_after_user_signup: true) stub_application_setting(require_admin_approval_after_user_signup: true)
......
...@@ -133,10 +133,6 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n ...@@ -133,10 +133,6 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n
context 'Change Sign-up restrictions' do context 'Change Sign-up restrictions' do
context 'Require Admin approval for new signup setting' do context 'Require Admin approval for new signup setting' do
context 'when feature is enabled' do context 'when feature is enabled' do
before do
stub_feature_flags(admin_approval_for_new_user_signups: true)
end
it 'changes the setting' do it 'changes the setting' do
page.within('.as-signup') do page.within('.as-signup') do
check 'Require admin approval for new sign-ups' check 'Require admin approval for new sign-ups'
...@@ -147,18 +143,6 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n ...@@ -147,18 +143,6 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
end end
end end
context 'when feature is disabled' do
before do
stub_feature_flags(admin_approval_for_new_user_signups: false)
end
it 'does not show the the setting' do
page.within('.as-signup') do
expect(page).not_to have_selector('.application_setting_require_admin_approval_after_user_signup')
end
end
end
end end
end end
......
...@@ -77,7 +77,6 @@ RSpec.describe "Admin::Users" do ...@@ -77,7 +77,6 @@ RSpec.describe "Admin::Users" do
context '`Pending approval` tab' do context '`Pending approval` tab' do
context 'feature is enabled' do context 'feature is enabled' do
before do before do
stub_feature_flags(admin_approval_for_new_user_signups: true)
visit admin_users_path visit admin_users_path
end end
...@@ -85,17 +84,6 @@ RSpec.describe "Admin::Users" do ...@@ -85,17 +84,6 @@ RSpec.describe "Admin::Users" do
expect(page).to have_link('Pending approval', href: admin_users_path(filter: 'blocked_pending_approval')) expect(page).to have_link('Pending approval', href: admin_users_path(filter: 'blocked_pending_approval'))
end end
end end
context 'feature is disabled' do
before do
stub_feature_flags(admin_approval_for_new_user_signups: false)
visit admin_users_path
end
it 'does not show the `Pending approval` tab' do
expect(page).not_to have_link('Pending approval', href: admin_users_path(filter: 'blocked_pending_approval'))
end
end
end end
end end
......
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