mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 21:56:19 +10:00
This new method wraps Gitlab::LDAP::Adapter.open to enable connection reuse.
24 lines
432 B
Ruby
24 lines
432 B
Ruby
module Gitlab
|
|
module LDAP
|
|
class Access
|
|
attr_reader :adapter
|
|
|
|
def self.open(&block)
|
|
Gitlab::LDAP::Adapter.open do |adapter|
|
|
block.call(self.new(adapter))
|
|
end
|
|
end
|
|
|
|
def initialize(adapter=nil)
|
|
@adapter = adapter
|
|
end
|
|
|
|
def allowed?(user)
|
|
!!Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter)
|
|
rescue
|
|
false
|
|
end
|
|
end
|
|
end
|
|
end
|