Commit f80dda64 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'remove_gma_member_cleanup_flag' into 'master'

Removed usages of gma_member_cleanup flag

See merge request gitlab-org/gitlab!43760
parents 2b6e5b85 8caba214
...@@ -23,7 +23,6 @@ module GroupSaml ...@@ -23,7 +23,6 @@ module GroupSaml
if updated && saml_provider.enforced_group_managed_accounts? && !group_managed_accounts_was_enforced if updated && saml_provider.enforced_group_managed_accounts? && !group_managed_accounts_was_enforced
require_linked_saml_to_enable_group_managed! require_linked_saml_to_enable_group_managed!
cleanup_members! if ::Feature.enabled?(:gma_member_cleanup)
end end
end end
end end
...@@ -36,12 +35,6 @@ module GroupSaml ...@@ -36,12 +35,6 @@ module GroupSaml
add_error!(_("Group Owner must have signed in with SAML before enabling Group Managed Accounts")) add_error!(_("Group Owner must have signed in with SAML before enabling Group Managed Accounts"))
end 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) def add_error!(message)
saml_provider.errors.add(:base, message) saml_provider.errors.add(:base, message)
......
...@@ -23,9 +23,6 @@ ...@@ -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?}" } .form-text.text-muted.js-helper-text{ style: "display: #{'none' if saml_provider.enforced_sso?} #{'block' unless saml_provider.enforced_sso?}" }
%span %span
= s_('GroupSAML|To be able to enable group managed accounts, you first need to enable enforced SSO.') = 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 .form-group
%label.toggle-wrapper.mb-0.js-group-saml-prohibited-outer-forks-toggle-area %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 = 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 ...@@ -28,13 +28,6 @@ RSpec.shared_examples 'base SamlProvider service' do
end end
RSpec.shared_examples 'SamlProvider service toggles Group Managed Accounts' do 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 context 'when enabling enforced_group_managed_accounts' do
let(:params) do let(:params) do
attributes_for(:saml_provider, :enforced_group_managed_accounts) attributes_for(:saml_provider, :enforced_group_managed_accounts)
...@@ -51,53 +44,6 @@ RSpec.shared_examples 'SamlProvider service toggles Group Managed Accounts' do ...@@ -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.to change { group.saml_provider&.enforced_group_managed_accounts? }.to(true)
end 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 context 'when owner has not linked SAML yet' do
before do before do
Identity.delete_all Identity.delete_all
...@@ -108,44 +54,6 @@ RSpec.shared_examples 'SamlProvider service toggles Group Managed Accounts' do ...@@ -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"]) expect(service.saml_provider.errors[:base]).to eq(["Group Owner must have signed in with SAML before enabling Group Managed Accounts"])
end 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 end
end end
...@@ -4506,9 +4506,6 @@ msgstr "" ...@@ -4506,9 +4506,6 @@ msgstr ""
msgid "Can't load mermaid module: %{err}" msgid "Can't load mermaid module: %{err}"
msgstr "" msgstr ""
msgid "Can't remove group members without group managed account"
msgstr ""
msgid "Can't scan the code?" msgid "Can't scan the code?"
msgstr "" msgstr ""
...@@ -12649,9 +12646,6 @@ msgstr "" ...@@ -12649,9 +12646,6 @@ msgstr ""
msgid "GroupSAML|Valid SAML Response" msgid "GroupSAML|Valid SAML Response"
msgstr "" 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." msgid "GroupSAML|With prohibit outer forks flag enabled group members will be able to fork project only inside your group."
msgstr "" 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