Commit 84e40a7d authored by James Lopez's avatar James Lopez

Add feature flag and small refactor

parent ae06ea33
--- ---
title: Resolve Automatically deprovision users when removed from a configured identity title: Automatically deprovision and update users from a configured identity via SCIM
provider
merge_request: 9388 merge_request: 9388
author: author:
type: added type: added
...@@ -37,6 +37,7 @@ module API ...@@ -37,6 +37,7 @@ module API
resource :Users do resource :Users do
before do before do
check_group_scim_enabled(find_group(params[:group]))
check_group_saml_configured check_group_saml_configured
end end
......
...@@ -135,6 +135,10 @@ module EE ...@@ -135,6 +135,10 @@ module EE
unauthorized! unless can?(current_user, :admin_group_saml, group) unauthorized! unless can?(current_user, :admin_group_saml, group)
end end
def check_group_scim_enabled(group)
forbidden!('Group SCIM not enabled.') unless Feature.enabled?(:group_scim, group)
end
def check_group_saml_configured def check_group_saml_configured
forbidden!('Group SAML not enabled.') unless ::Gitlab::Auth::GroupSaml::Config.enabled? forbidden!('Group SAML not enabled.') unless ::Gitlab::Auth::GroupSaml::Config.enabled?
end end
......
...@@ -36,7 +36,7 @@ describe EE::Gitlab::Scim::ParamsParser do ...@@ -36,7 +36,7 @@ describe EE::Gitlab::Scim::ParamsParser do
expect(described_class.new(operations: operations).deprovision_user?).to be true expect(described_class.new(operations: operations).deprovision_user?).to be true
end end
it 'returns an empty hash for the wrong operations' do it 'returns false when not deprovisioning' do
operations = [{ "op": "Replace", "path": "active", "value": "True" }] operations = [{ "op": "Replace", "path": "active", "value": "True" }]
expect(described_class.new(operations: operations).deprovision_user?).to be false expect(described_class.new(operations: operations).deprovision_user?).to be 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