From 655f23111cdedc41c277551c1b01ac723672a575 Mon Sep 17 00:00:00 2001 From: Jerry Cheung Date: Wed, 15 Oct 2014 15:21:38 -0700 Subject: [PATCH 1/2] add failing test --- test/domain_test.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/domain_test.rb b/test/domain_test.rb index 8ddf72c..797f716 100644 --- a/test/domain_test.rb +++ b/test/domain_test.rb @@ -126,6 +126,11 @@ def test_user_returns_every_attribute assert_equal ['user1@github.com'], user[:mail] end + def test_user_returns_subset_of_attributes + assert entry = @domain.user?('user1', :attributes => [:cn]) + assert_equal [:dn, :cn], entry.attribute_names + end + def test_auth_binds assert user = @domain.user?('user1') assert @domain.auth(user, 'passworD1'), 'Expected user to bind' From e132db4c9866dea311db1527783650fe01a00745 Mon Sep 17 00:00:00 2001 From: Jerry Cheung Date: Wed, 15 Oct 2014 15:22:17 -0700 Subject: [PATCH 2/2] pass through search options --- lib/github/ldap/domain.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/github/ldap/domain.rb b/lib/github/ldap/domain.rb index 8085c44..aa2066b 100644 --- a/lib/github/ldap/domain.rb +++ b/lib/github/ldap/domain.rb @@ -110,11 +110,15 @@ def valid_login?(login, password) # Check if a user exists based in the `uid`. # # login: is the user's login + # search_options: Net::LDAP#search compatible options to pass through # # Returns the user if the login matches any `uid`. # Returns nil if there are no matches. - def user?(login) - search(filter: login_filter(@uid, login), size: 1).first + def user?(login, search_options = {}) + options = search_options.merge \ + filter: login_filter(@uid, login), + size: 1 + search(options).first end # Check if a user can be bound with a password. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy