Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/domain7/arldap
Active Record LDAP
https://github.com/domain7/arldap
Last synced: 1 day ago
JSON representation
Active Record LDAP
- Host: GitHub
- URL: https://github.com/domain7/arldap
- Owner: domain7
- Created: 2011-12-09T18:37:42.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2011-12-09T18:41:02.000Z (about 13 years ago)
- Last Synced: 2024-12-30T12:45:30.660Z (11 days ago)
- Language: Ruby
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
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],
}
enddef self.search(query)
Person.find(:all,
:conditions => ["(email LIKE ?) OR (firstname LIKE ?) OR (lastname LIKE ?)",
"#{query}%", "#{query}%", "#{query}%"])
end
end