Commit 1aecf77f authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Merge branch 'fix_ldap_security_external_login_10_3_redux' into 'security-10-3-ee'

Fix LDAP external user/group bug on first sign in

See merge request gitlab/gitlab-ee!569
parent 0c1cc93d
---
title: Fix LDAP external user/group bug on first sign in
merge_request:
author:
type: security
...@@ -17,6 +17,8 @@ module EE ...@@ -17,6 +17,8 @@ module EE
# Intended to be called during #initialize, and #save should be called # Intended to be called during #initialize, and #save should be called
# after initialize. # after initialize.
def set_external_with_external_groups def set_external_with_external_groups
return if ldap_config.external_groups.empty?
gl_user.external = in_any_external_group? gl_user.external = in_any_external_group?
end end
......
...@@ -100,6 +100,14 @@ describe Gitlab::LDAP::User do ...@@ -100,6 +100,14 @@ describe Gitlab::LDAP::User do
it "sets the user's external flag to false" do it "sets the user's external flag to false" do
expect(gl_user.external).to be_falsey expect(gl_user.external).to be_falsey
end end
context 'when the user_default_external application setting is true' do
it 'does not set the external flag to false' do
stub_application_setting(user_default_external: true)
expect(gl_user.external).to be_truthy
end
end
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