Class: KU::LDAP::Entry::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ku/ldap/entry/base.rb

Direct Known Subclasses

Group, User

Constant Summary collapse

BASE =
ENV['KU_LDAP_BASE'] || 'dc=sc,dc=ku,dc=dk'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry) ⇒ Base

Returns a new instance of Base.



20
21
22
# File 'lib/ku/ldap/entry/base.rb', line 20

def initialize entry
  @entry = entry || Hash.new([])
end

Class Method Details

.first(directory, id, filter = Filter.new) ⇒ Object



10
11
12
13
# File 'lib/ku/ldap/entry/base.rb', line 10

def self.first directory, id, filter=Filter.new
  entry = directory.first base, filter.eq(identifier, id)
  new entry if entry
end

.search(directory, attribute, value, matcher, filter = Filter.new) ⇒ Object



15
16
17
18
# File 'lib/ku/ldap/entry/base.rb', line 15

def self.search directory, attribute, value, matcher, filter=Filter.new
  filt = filter.send matcher.to_sym, attribute, value
  Array(directory.search(base, filt)).map {|entry| new entry}
end

Instance Method Details

#==(other) ⇒ Object Also known as: eq?



24
25
26
# File 'lib/ku/ldap/entry/base.rb', line 24

def ==(other)
  id == other.id
end