Skip to content

Add Active Directory group filter #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2014
Merged

Conversation

jch
Copy link
Contributor

@jch jch commented Dec 23, 2014

This adds an additional filter to support AD when querying for groups. We can add an integration test for this later on, but I'll include results from manual testing in a bit.

cc @mtodd

@@ -3,7 +3,8 @@ class Ldap
module Filter
ALL_GROUPS_FILTER = Net::LDAP::Filter.eq("objectClass", "groupOfNames") |
Net::LDAP::Filter.eq("objectClass", "groupOfUniqueNames") |
Net::LDAP::Filter.eq("objectClass", "posixGroup")
Net::LDAP::Filter.eq("objectClass", "posixGroup") |
Net::LDAP::Filter.eq("objectClass", "group")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Would love to see a comment with a specific mention of Active Directory.

@mtodd
Copy link
Member

mtodd commented Dec 23, 2014

Aside from the comment, this should be sufficient to fix the issue.

@jch adding a test for Domain#filter_groups would be really great! Especially if we can validate it against Active Directory with our local test VM.

@jch
Copy link
Contributor Author

jch commented Dec 23, 2014

I was able to get the following test working in test/domain_test.rb, but it breaks the other tests in the file b/c of how we skip integration tests. I'm going to file a separate issue for cleaning up AD testing and adding the test from there.

class GitHubLdapActiveDirectoryGroupsTest < GitHub::Ldap::Test
  def run(*)
    self.class.test_env != "activedirectory" ? super : self
  end

  def test_filter_groups
    domain = @ldap.domain("DC=ad,DC=ghe,DC=local")
    results = domain.filter_groups("ghe-admins")
    assert_equal 1, results.size
  end
end

@mtodd cool to merge this as-is, and cutting a release from here? Alternatively, I can create another test file with just this test in it and merge them back together in another file.

@jch jch self-assigned this Dec 23, 2014
@mtodd
Copy link
Member

mtodd commented Dec 23, 2014

@jch let's cut the release and then worry about adding tests. :shipit:

jch added a commit that referenced this pull request Dec 23, 2014
@jch jch merged commit 32e2298 into master Dec 23, 2014
@jch jch deleted the active-directory-group-filter branch December 23, 2014 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants