diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-01-28 13:31:48 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-01-28 13:31:48 -0500 |
commit | 1e666ce6958b2b911276d533a9efd699884f6a71 (patch) | |
tree | 8e2a9a72a9d321c7c90e66caa5c6d8dbe285fba7 /app/controllers/omniauth_callbacks_controller.rb | |
parent | ca171b8190623023f3e6d00146abee8651cec857 (diff) | |
download | gitlab-ce-1e666ce6958b2b911276d533a9efd699884f6a71.tar.gz |
Backport LDAP user assignment changes from EE
See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/146
Diffstat (limited to 'app/controllers/omniauth_callbacks_controller.rb')
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 4cad98b8e98..4c13228fce9 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -21,15 +21,16 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController # We only find ourselves here # if the authentication to LDAP was successful. def ldap - @user = Gitlab::LDAP::User.new(oauth) - @user.save if @user.changed? # will also save new users - gl_user = @user.gl_user - gl_user.remember_me = params[:remember_me] if @user.persisted? + ldap_user = Gitlab::LDAP::User.new(oauth) + ldap_user.save if ldap_user.changed? # will also save new users + + @user = ldap_user.gl_user + @user.remember_me = params[:remember_me] if ldap_user.persisted? # Do additional LDAP checks for the user filter and EE features - if @user.allowed? - log_audit_event(gl_user, with: :ldap) - sign_in_and_redirect(gl_user) + if ldap_user.allowed? + log_audit_event(@user, with: :ldap) + sign_in_and_redirect(@user) else flash[:alert] = "Access denied for your LDAP account." redirect_to new_user_session_path |