Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ambition adapter for ActiveLdap

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Manifest
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
README.textile

An Ambitious ActiveLdap Adapter

Write LDAP search filters in Ruby. Awesomeness courtesy of Chris Wanstrath’s Ambition library.

You must be using ActiveLdap 0.9 or greater.

Get It

$ sudo gem install ambitious-activeldap

require 'rubygems'
require 'ambition/adapters/active_ldap'

Examples

Let User be a subclass of ActiveLdap::Base

User.select { |u| u.givenName == ‘Severian’ }.each do |user|
puts user.name
end

Queries don’t run until you kick them. This adapter supports only the basic kicker methods: each, each_with_index, map, entries, to_a.

This adapter also doesn’t support the methods that require sorting, slicing, or counting, because OpenLDAP effectively doesn’t support such things. ActiveLdap lets you request sorted and sliced result sets, but it does the work in Ruby, so you might as well do it yourself.

You can call to_s, but not to_hash on a query. to_s returns the LDAP search filter as a string.

>> User.select { |m| m.givenName == ‘Jonas’ }.to_s
=> “(givenName=Jonas)”

Issues.find(:all, :filter => “(type=bug)”)

Found a bug? Sweet. Add it at the Lighthouse.

More information on Ambition:

Something went wrong with that request. Please try again.