Commit 8caba214 authored by Aishwarya Subramanian's avatar Aishwarya Subramanian

Removed usages of gma_member_cleanup flag

The gma_member_cleanup flag was never enabled on
production and staging ever since it was introduced
This MR removes the flag as well as the code related
to removal of group members on GMA conversion.
parent 8a4c87fe
......@@ -23,7 +23,6 @@ module GroupSaml
if updated && saml_provider.enforced_group_managed_accounts? && !group_managed_accounts_was_enforced
require_linked_saml_to_enable_group_managed!
cleanup_members! if ::Feature.enabled?(:gma_member_cleanup)
end
end
end
......@@ -36,12 +35,6 @@ module GroupSaml
add_error!(_("Group Owner must have signed in with SAML before enabling Group Managed Accounts"))
end
def cleanup_members!
return if GroupManagedAccounts::CleanUpMembersService.new(current_user, group).execute
add_error!(_("Can't remove group members without group managed account"))
end
def add_error!(message)
saml_provider.errors.add(:base, message)
......
......@@ -23,9 +23,6 @@
.form-text.text-muted.js-helper-text{ style: "display: #{'none' if saml_provider.enforced_sso?} #{'block' unless saml_provider.enforced_sso?}" }
%span
= s_('GroupSAML|To be able to enable group managed accounts, you first need to enable enforced SSO.')
- if Feature.enabled?(:gma_member_cleanup)
.bs-callout.bs-callout-info.js-callout{ style: "display: #{'block' if saml_provider.enforced_sso?} #{'none' unless saml_provider.enforced_sso?}" }
= s_('GroupSAML|With group managed accounts enabled, all the users without a group managed account will be excluded from the group.')
.form-group
%label.toggle-wrapper.mb-0.js-group-saml-prohibited-outer-forks-toggle-area
= render "shared/buttons/project_feature_toggle", is_checked: saml_provider.prohibited_outer_forks, disabled: !saml_provider.enforced_group_managed_accounts?, label: s_("GroupSAML|Prohibit outer forks"), class_list: "js-project-feature-toggle js-group-saml-prohibited-outer-forks-toggle project-feature-toggle d-inline", data: { qa_selector: 'prohibited_outer_forks_toggle_button' } do
......
---
name: gma_member_cleanup
introduced_by_url:
rollout_issue_url:
group:
type: development
default_enabled: false
......@@ -28,13 +28,6 @@ RSpec.shared_examples 'base SamlProvider service' do
end
RSpec.shared_examples 'SamlProvider service toggles Group Managed Accounts' do
let(:cleanup_members_service_spy) { spy('GroupSaml::GroupManagedAccounts::CleanUpMembersService') }
before do
allow(GroupSaml::GroupManagedAccounts::CleanUpMembersService)
.to receive(:new).with(current_user, group).and_return(cleanup_members_service_spy)
end
context 'when enabling enforced_group_managed_accounts' do
let(:params) do
attributes_for(:saml_provider, :enforced_group_managed_accounts)
......@@ -51,53 +44,6 @@ RSpec.shared_examples 'SamlProvider service toggles Group Managed Accounts' do
end.to change { group.saml_provider&.enforced_group_managed_accounts? }.to(true)
end
it 'cleans up group members' do
service.execute
expect(cleanup_members_service_spy).to have_received(:execute)
end
context 'when member cleanup flag is turned off' do
before do
stub_feature_flags(gma_member_cleanup: false)
end
it 'does not invoke cleaning up of group members' do
service.execute
expect(cleanup_members_service_spy).not_to have_received(:execute)
end
end
context 'when save fails' do
let(:params) do
super().merge(sso_url: 'NOTANURL<>&*^')
end
it 'does not trigger members cleanup' do
service.execute
expect(cleanup_members_service_spy).not_to have_received(:execute)
end
end
context 'when clean up fails' do
before do
allow(cleanup_members_service_spy).to receive(:execute).and_return(false)
end
it 'adds an error to saml provider' do
expect { service.execute }.to change { group.saml_provider && group.saml_provider.errors[:base] }
.to(["Can't remove group members without group managed account"])
end
it 'does not change saml_provider' do
expect do
service.execute
group.reload
end.not_to change { group.saml_provider }
end
end
context 'when owner has not linked SAML yet' do
before do
Identity.delete_all
......@@ -108,44 +54,6 @@ RSpec.shared_examples 'SamlProvider service toggles Group Managed Accounts' do
expect(service.saml_provider.errors[:base]).to eq(["Group Owner must have signed in with SAML before enabling Group Managed Accounts"])
end
it 'does not attempt member cleanup' do
service.execute
expect(cleanup_members_service_spy).not_to have_received(:execute)
end
end
end
context 'when group managed accounts was enabled beforehand' do
let(:params) do
attributes_for(:saml_provider, :enforced_group_managed_accounts)
end
before do
saml_provider.update!(enforced_group_managed_accounts: true)
end
it 'does not clean up group members' do
service.execute
expect(cleanup_members_service_spy).not_to have_received(:execute)
end
end
context 'when enforced_group_managed_accounts is disabled' do
before do
saml_provider.update!(enforced_group_managed_accounts: true)
end
let(:params) do
attributes_for(:saml_provider, enabled: true, enforced_sso: true, enforced_group_managed_accounts: false)
end
it 'does not clean up group members' do
service.execute
expect(cleanup_members_service_spy).not_to have_received(:execute)
end
end
end
......@@ -8,8 +8,6 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-22 19:32+0200\n"
"PO-Revision-Date: 2020-09-22 19:32+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
......@@ -4493,9 +4491,6 @@ msgstr ""
msgid "Can't load mermaid module: %{err}"
msgstr ""
msgid "Can't remove group members without group managed account"
msgstr ""
msgid "Can't scan the code?"
msgstr ""
......@@ -12630,9 +12625,6 @@ msgstr ""
msgid "GroupSAML|Valid SAML Response"
msgstr ""
msgid "GroupSAML|With group managed accounts enabled, all the users without a group managed account will be excluded from the group."
msgstr ""
msgid "GroupSAML|With prohibit outer forks flag enabled group members will be able to fork project only inside your group."
msgstr ""
......
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