diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-14 12:58:43 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-03-14 12:58:43 +0200 |
commit | 1ec106b853cf2b3aa7c8fa29e24d1f429df2f0a8 (patch) | |
tree | d310c675e58ca8c9f7ffa6d2da186036366fd518 /app | |
parent | bce8edbbcc03bd29230124f9d7871dabbc79d38f (diff) | |
parent | 48e9054056db7f14bdef0d2d5c859f357110ed95 (diff) | |
download | gitlab-ce-1ec106b853cf2b3aa7c8fa29e24d1f429df2f0a8.tar.gz |
Merge branch 'ldap_connections'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
CHANGELOG
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application_controller.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9a0c9f60b05..5f8b2da06f8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -182,13 +182,15 @@ class ApplicationController < ActionController::Base def ldap_security_check if current_user && current_user.requires_ldap_check? - if gitlab_ldap_access.allowed?(current_user) - current_user.last_credential_check_at = Time.now - current_user.save - else - sign_out current_user - flash[:alert] = "Access denied for your LDAP account." - redirect_to new_user_session_path + gitlab_ldap_access do |access| + if access.allowed?(current_user) + current_user.last_credential_check_at = Time.now + current_user.save + else + sign_out current_user + flash[:alert] = "Access denied for your LDAP account." + redirect_to new_user_session_path + end end end end @@ -198,8 +200,8 @@ class ApplicationController < ActionController::Base @event_filter ||= EventFilter.new(filters) end - def gitlab_ldap_access - Gitlab::LDAP::Access.new + def gitlab_ldap_access(&block) + Gitlab::LDAP::Access.open { |access| block.call(access) } end # JSON for infinite scroll via Pager object |