Project

General

Profile

« Previous | Next » 

Revision 3cdff641

Added by Marc Dequènes over 13 years ago

  • ID 3cdff641250aa4c4ed92bcc471b80acf0f692ac2

[evol] Librarian API work §2

View differences:

lib/cyborghood-librarian/records.rb
module CyborgHood
module LibrarianLand
class Records
def persons
LdapPerson.find(:all, :attributes => ['uid']).collect{|i| i.uid }
def persons(obj_name = nil)
if obj_name.nil?
LdapPerson.find(:all, :attributes => ['uid']).collect{|i| i.uid }
else
list = LdapPerson.find(:all, :attribute => 'uid', :value => obj_name)
return if list.nil? or list.empty?
return list.first if list.size == 1
raise CyberError.new(:unrecoverable, "db/ldap", "broken DB: multiple Person with the same uid")
end
end
def dns_domains
LdapDnsDomain.find(:all, :attributes => ['cn']).collect{|i| i.cn }
def dns_domains(obj_name = nil)
if obj_name.nil?
LdapDnsDomain.find(:all, :attributes => ['cn']).collect{|i| i.cn }
else
list = LdapDnsDomain.find(:all, :attribute => 'cn', :value => obj_name)
return if list.nil? or list.empty?
return list.first if list.size == 1
raise CyberError.new(:unrecoverable, "db/ldap", "broken DB: multiple DnsDomain with the same cn")
end
end
end
end # LibrarianLand

Also available in: Unified diff