github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

thoughtbot / ldap-activerecord-gateway

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 44
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.
  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

fixed documentation 
tsaleh (author)
Thu Aug 09 07:11:55 -0700 2007
commit  709c0131ae2a6323801553e74f2cd23d86b48b2c
tree    9f639954e804e47814ae9f446b093dd7ba56f842
parent  cd31cf7b0e33d0e362a6f598ced37f0c4ae293f4
ldap-activerecord-gateway /
name age
history
message
file README Loading commit data...
file Rakefile Wed May 09 06:54:18 -0700 2007 - Added tests - Large amount of refactoring ... [tsaleh]
directory bin/ Wed May 09 06:54:18 -0700 2007 - Added tests - Large amount of refactoring ... [tsaleh]
directory conf/ Mon Nov 06 10:08:40 -0800 2006 Cleaned up example configuration file. git-svn... [tsaleh]
directory lib/ Wed May 16 08:12:58 -0700 2007 debugging git-svn-id: https://svn.thoughtbot.c... [tsaleh]
directory test/ Wed May 16 08:11:19 -0700 2007 debugging git-svn-id: https://svn.thoughtbot.c... [tsaleh]
README
ldap-activerecord-gateway
=========================

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 use, configure the server by creating a conf/ldap-server.yml file (see ldap-server.example.yml).
The important bits are rails_dir, active_record_model, basedn, and port.  Once that's done,
run "./bin/ldap-server.rb start", wait for it to daemonize, and check the log file under $RAILS_ROOT/log/ for
errors.  To stop, run "./bin/ldap-server.rb", and if you reconfigure the server or change the underlying
AR model, restart it with "./bin/ldap-server.rb restart".

To test, point your addressbook (ie: 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

Have fun.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server