Commit baa65e89b90f21047e586c5842a1b7d499625fd0
1 parent
2db94109
Exists in
master
and in
4 other branches
Check if LDAP user was removed or blocked when use git over ssh
Showing
2 changed files
with
11 additions
and
0 deletions
Show diff stats
lib/api/internal.rb
lib/gitlab/ldap/user.rb
... | ... | @@ -71,6 +71,16 @@ module Gitlab |
71 | 71 | find_by_uid(ldap_user.dn) if ldap_user |
72 | 72 | end |
73 | 73 | |
74 | + # Check LDAP user existance by dn. User in git over ssh check | |
75 | + # | |
76 | + # It covers 2 cases: | |
77 | + # * when ldap account was removed | |
78 | + # * when ldap account was deactivated by change of OU membership in 'dn' | |
79 | + def blocked?(dn) | |
80 | + ldap = OmniAuth::LDAP::Adaptor.new(ldap_conf) | |
81 | + ldap.connection.search(base: dn, size: 1).blank? | |
82 | + end | |
83 | + | |
74 | 84 | private |
75 | 85 | |
76 | 86 | def find_by_uid(uid) | ... | ... |