diff options
author | Marin Jankovski <marin@gitlab.com> | 2016-04-13 16:09:47 +0300 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2016-04-13 16:09:47 +0300 |
commit | c74604699269a2edbbe937309cce7a4ed789cb07 (patch) | |
tree | 3dc05906df853581ffed364ae554d3aeeedcd19f /lib | |
parent | ab4ea3720c084063ab83cef3aaf3a0b6adbc2a3c (diff) | |
parent | 61fc9aa87ea3752f3c7b853ab1cb102e53d392f2 (diff) |
Merge branch 'external-omniauth-providers' into 'master'
Allow Omniauth providers to be marked as external
Related to #4009
With this MR we will be able to allow the user to set which Omniauth Providers they would like to have as external. All users login in via these providers will be marked as external, even if they already had an account before. If the provider is removed form the list of external providers, the users will be marked as internal at their next login.
MR for Omnibus: gitlab-org/omnibus-gitlab!727
/cc @dblessing @DouweM
See merge request !3657
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/o_auth/user.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb index 832fb08a526..356e96fcbab 100644 --- a/lib/gitlab/o_auth/user.rb +++ b/lib/gitlab/o_auth/user.rb @@ -54,6 +54,12 @@ module Gitlab @user ||= build_new_user end + if external_provider? && @user + @user.external = true + elsif @user + @user.external = false + end + @user end @@ -113,6 +119,10 @@ module Gitlab end end + def external_provider? + Gitlab.config.omniauth.external_providers.include?(auth_hash.provider) + end + def block_after_signup? if creating_linked_ldap_user? ldap_config.block_auto_created_users |