diff options
Diffstat (limited to 'lib/gitlab/ldap/person.rb')
-rw-r--r-- | lib/gitlab/ldap/person.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index 06b17c58f8c..fa57f298e16 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -1,6 +1,8 @@ module Gitlab module LDAP class Person + AD_USER_DISABLED = Net::LDAP::Filter.ex("userAccountControl:1.2.840.113556.1.4.803", 2) + def self.find_by_uid(uid, adapter=nil) adapter ||= Gitlab::LDAP::Adapter.new adapter.user(config.uid, uid) @@ -11,6 +13,11 @@ module Gitlab adapter.user('dn', dn) end + def self.ad_disabled?(dn, adapter=nil) + adapter ||= Gitlab::LDAP::Adapter.new + adapter.dn_matches_filter?(dn, AD_USER_DISABLED) + end + def initialize(entry) Rails.logger.debug { "Instantiating #{self.class.name} with LDIF:\n#{entry.to_ldif}" } @entry = entry |