github-ldap 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5094836df33821281e971a9d3f1028df7cba6d71
4
- data.tar.gz: f681bea4b0ae307888cd037db8b232e4e08af462
3
+ metadata.gz: 28c2327d79def9d64d8f90b46e6a12b7055ed6ac
4
+ data.tar.gz: 3e1a9c422a6d1729c526d21657c51ee15b7662c3
5
5
  SHA512:
6
- metadata.gz: a6464449256546e16d1962bba8b3c6599a5eb3e6f41d965225c540a98c2d1f19313e90da62c3ca84a09ae374fdde525d68089da73c251681b28053c09e23e9b6
7
- data.tar.gz: 6830909544c79613b8ea4626032303b6ef8a3aa8d25ea95fe6347257bae7ca9c2e3ca881c6711a3cd27836d866ae8e3bdfe18d7035053b78f7628a2760ad776c
6
+ metadata.gz: b347d766538664ea6d4a5b93cc4f4ef7eea792f601ae03e4aa8a4f824e0e3d9aa7867257cad27e7daee6a686e1e144b23b5531cb6f38a4b1394f4d3688f8c981
7
+ data.tar.gz: 424fa3a3f07d1871c464d9aae38cd48dc2dec3b0a6200060923ee20d13ba59e70c815fca37047d18577d40a034b2a3d4c068b9b39d71d5d13ebb96849d156460
data/github-ldap.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "github-ldap"
5
- spec.version = "1.1.0"
5
+ spec.version = "1.1.1"
6
6
  spec.authors = ["David Calavera"]
7
7
  spec.email = ["david.calavera@gmail.com"]
8
8
  spec.description = %q{Ldap authentication for humans}
data/lib/github/ldap.rb CHANGED
@@ -87,11 +87,15 @@ module GitHub
87
87
  # base_name: is the dn of the base root.
88
88
  #
89
89
  # Returns a new Group object.
90
+ # Returns nil if the dn is not in the server.
90
91
  def group(base_name)
92
+ entry = domain(base_name).bind
93
+ return unless entry
94
+
91
95
  if @virtual_attributes.enabled?
92
- VirtualGroup.new(self, domain(base_name).bind)
96
+ VirtualGroup.new(self, entry)
93
97
  else
94
- Group.new(self, domain(base_name).bind)
98
+ Group.new(self, entry)
95
99
  end
96
100
  end
97
101
 
data/test/group_test.rb CHANGED
@@ -6,11 +6,12 @@ class GitHubLdapGroupTest < GitHub::Ldap::Test
6
6
  end
7
7
 
8
8
  def groups_domain
9
- GitHub::Ldap.new(options).domain("ou=groups,dc=github,dc=com")
9
+ @ldap.domain("ou=groups,dc=github,dc=com")
10
10
  end
11
11
 
12
12
  def setup
13
- @group = GitHub::Ldap.new(options).group("cn=enterprise,ou=groups,dc=github,dc=com")
13
+ @ldap = GitHub::Ldap.new(options)
14
+ @group = @ldap.group("cn=enterprise,ou=groups,dc=github,dc=com")
14
15
  end
15
16
 
16
17
  def test_subgroups
@@ -30,6 +31,11 @@ class GitHubLdapGroupTest < GitHub::Ldap::Test
30
31
  groups = groups_domain.filter_groups('devs')
31
32
  assert_equal 1, groups.size
32
33
  end
34
+
35
+ def test_unknown_group
36
+ refute @ldap.group("cn=foobar,ou=groups,dc=github,dc=com"),
37
+ "Expected to not bind any group"
38
+ end
33
39
  end
34
40
 
35
41
  class GitHubLdapLoopedGroupTest < GitHub::Ldap::Test
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-ldap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Calavera