Sha256: 9ac2084e0c9933c04783f36dc83bb1af0deaca04bc9b97196cb78d222d67326d

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

arldap
=========================

This is an implementation of an LDAP server which uses active record as the data source.
The server is read-only, and can serve information from any AR model that implements the
#search(string) class method and the #to_ldap_entry instance method.

To test, point your addressbook (ie: Outlook, Thunderbird or OS X Address Book) at the server and run a search.

Example AR class:

class Person < ActiveRecord::Base
  def fullname
    "#{firstname} #{lastname}"
  end
  
  def to_ldap_entry
  {	
    "objectclass"     => ["top", "person", "organizationalPerson", "inetOrgPerson", "mozillaOrgPerson"],
    "uid"             => ["tbotter-#{id}"],
    "sn"              => [lastname],
    "givenName"       => [firstname],
    "cn"              => [fullname],
    "title"           => [title],
    "o"               => [company], 
    "mail"            => [email],
    "telephonenumber" => [work_phone], 
    "homephone"       => [home_phone],
    "fax"             => [fax],
    "mobile"          => [mobile],
    "street"          => [address],
    "l"               => [city],
    "st"              => [state], 
    "postalcode"      => [zip], 
  }
  end

  def self.search(query)
    Person.find(:all, 
                :conditions => ["(email LIKE ?) OR (firstname LIKE ?) OR (lastname LIKE ?)", 
                                "#{query}%", "#{query}%", "#{query}%"])
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arldap-0.0.1 README