diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-02-18 22:14:53 +0100 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-02-18 22:14:53 +0100 |
commit | 873b0db220b92008ed833f0909ecab8861bf00e8 (patch) | |
tree | b84cb7114af9a4f5c30a8e19342a32e7ec18e42b /lib | |
parent | 6524fbeaba7c16ae8ca514c7540a1aa6e86f4129 (diff) | |
download | gitlab-ce-873b0db220b92008ed833f0909ecab8861bf00e8.tar.gz |
Revert "Merge branch 'saml-decoupling' into 'master'
"
This reverts commit c04e22fba8d130a58f498ff48127712d7dae17ee, reversing
changes made to 0feab326d52222dc0ab5bd0a6b15dab297f44aa9.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ldap/user.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/o_auth/user.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/saml/user.rb | 47 |
3 files changed, 4 insertions, 56 deletions
diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb index b84c81f1a6c..e044f0ecc6d 100644 --- a/lib/gitlab/ldap/user.rb +++ b/lib/gitlab/ldap/user.rb @@ -24,10 +24,6 @@ module Gitlab update_user_attributes end - def save - super('LDAP') - end - # instance methods def gl_user @gl_user ||= find_by_uid_and_provider || find_by_email || build_new_user diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb index 675ded92a89..d87a72f7ba3 100644 --- a/lib/gitlab/o_auth/user.rb +++ b/lib/gitlab/o_auth/user.rb @@ -26,7 +26,7 @@ module Gitlab gl_user.try(:valid?) end - def save(provider = 'OAuth') + def save unauthorized_to_create unless gl_user if needs_blocking? @@ -36,10 +36,10 @@ module Gitlab gl_user.save! end - log.info "(#{provider}) saving user #{auth_hash.email} from login with extern_uid => #{auth_hash.uid}" + log.info "(OAuth) saving user #{auth_hash.email} from login with extern_uid => #{auth_hash.uid}" gl_user rescue ActiveRecord::RecordInvalid => e - log.info "(#{provider}) Error saving user: #{gl_user.errors.full_messages}" + log.info "(OAuth) Error saving user: #{gl_user.errors.full_messages}" return self, e.record.errors end @@ -105,8 +105,7 @@ module Gitlab end def signup_enabled? - providers = Gitlab.config.omniauth.allow_single_sign_on - providers.include?(auth_hash.provider) + Gitlab.config.omniauth.allow_single_sign_on end def block_after_signup? diff --git a/lib/gitlab/saml/user.rb b/lib/gitlab/saml/user.rb deleted file mode 100644 index b1e30110ef5..00000000000 --- a/lib/gitlab/saml/user.rb +++ /dev/null @@ -1,47 +0,0 @@ -# SAML extension for User model -# -# * Find GitLab user based on SAML uid and provider -# * Create new user from SAML data -# -module Gitlab - module Saml - class User < Gitlab::OAuth::User - - def save - super('SAML') - end - - def gl_user - @user ||= find_by_uid_and_provider - - if auto_link_ldap_user? - @user ||= find_or_create_ldap_user - end - - if auto_link_saml_enabled? - @user ||= find_by_email - end - - if signup_enabled? - @user ||= build_new_user - end - - @user - end - - def find_by_email - if auth_hash.has_email? - user = ::User.find_by(email: auth_hash.email.downcase) - user.identities.new(extern_uid: auth_hash.uid, provider: auth_hash.provider) if user - user - end - end - - protected - - def auto_link_saml_enabled? - Gitlab.config.omniauth.auto_link_saml_user - end - end - end -end |