KU::LDAP
A client for the Copenhagen University LDAP service.
Installation
Add this line to your application's Gemfile:
gem 'ku-ldap'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ku-ldap
Usage
Users
Find a user by ID:
KU::LDAP.user 'abc123'
Search for users with an attribute matching a given string:
KU::LDAP.users :givenname, 'foo'
The matcher is an optional argument (default :contains
):
KU::LDAP.users :givenname, 'oo', :ends
Available matchers:
:begins, :contains, :ends, :eq
Find and authenticate a user by ID and password:
KU::LDAP.authenticate 'abc123', 'password'
User metadata:
user = KU::LDAP.user 'abc123'
user.id
user.first_name
user.last_name
user.full_name
user.title
user.primary_institution
user.department
user.email
user.primary_group
user.groups
user.group_ids
Groups
Find a group by name:
KU::LDAP.group 'foo'
Search for groups with an attribute containing a given string:
KU::LDAP.groups :description, 'foo'
Or, with an alternate matcher:
KU::LDAP.groups :description, 'foo', :begins
Group metadata:
group = KU::LDAP.group 'foo'
group.id
group.description
group.primary_institution
group.members
Group membership:
group.member? 'abc123'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request