diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index 06b17c5..fa57f29 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 -- libgit2 0.21.2