Class: ASF::Service
Instance Attribute Summary
Attributes inherited from Base
#name
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
[], #base, base, collection, find, #id, #initialize, new, #reference
Constructor Details
This class inherits a constructor from ASF::Base
Class Method Details
.list(filter = 'cn=*') ⇒ Object
324
325
326
|
# File 'lib/whimsy/asf/ldap.rb', line 324
def self.list(filter='cn=*')
ASF.search_one(base, filter, 'cn').flatten
end
|
Instance Method Details
#add(people) ⇒ Object
343
344
345
346
347
|
# File 'lib/whimsy/asf/ldap.rb', line 343
def add(people)
people = Array(people).map(&:dn)
mod = ::LDAP::Mod.new(::LDAP::LDAP_MOD_ADD, 'member', people)
ASF.ldap.modify(self.dn, [mod])
end
|
#dn ⇒ Object
328
329
330
|
# File 'lib/whimsy/asf/ldap.rb', line 328
def dn
"cn=#{id},#{self.class.base}"
end
|
#members ⇒ Object
332
333
334
335
|
# File 'lib/whimsy/asf/ldap.rb', line 332
def members
ASF.search_one(base, "cn=#{name}", 'member').flatten.
map {|uid| Person.find uid[/uid=(.*?),/,1]}
end
|
#remove(people) ⇒ Object
337
338
339
340
341
|
# File 'lib/whimsy/asf/ldap.rb', line 337
def remove(people)
people = Array(people).map(&:dn)
mod = ::LDAP::Mod.new(::LDAP::LDAP_MOD_DELETE, 'member', people)
ASF.ldap.modify(self.dn, [mod])
end
|