Skip to content

Commit be83e88

Browse files
committed
Add failing test case for deeply nested membership checks
1 parent 744b141 commit be83e88

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

test/domain_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ def test_membership_in_subgroups
158158
assert @domain.is_member?(user, %w(enterprise-ops)),
159159
"Expected `enterprise-ops` to include the member `#{user.dn}`"
160160
end
161+
162+
def test_membership_in_deeply_nested_subgroups
163+
assert user = @ldap.domain('uid=user1.1.1.1,ou=users,dc=github,dc=com').bind
164+
165+
assert @domain.is_member?(user, %w(group1)),
166+
"Expected `group1` to include the member `#{user.dn}` via deep recursion"
167+
end
161168
end
162169

163170
class GitHubLdapPosixGroupsWithRecursionFallbackTest < GitHub::Ldap::Test

test/fixtures/github-with-subgroups.ldif

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,29 @@ objectClass: groupOfNames
4343
member: uid=calavera,ou=users,dc=github,dc=com
4444
member: uid=rubiojr,ou=users,dc=github,dc=com
4545

46+
dn: cn=group1,ou=groups,dc=github,dc=com
47+
cn: group1
48+
objectClass: groupOfNames
49+
member: uid=user1,ou=users,dc=github,dc=com
50+
member: cn=group1.1,ou=groups,dc=github,dc=com
51+
52+
dn: cn=group1.1,ou=groups,dc=github,dc=com
53+
cn: group1
54+
objectClass: groupOfNames
55+
member: uid=user1.1,ou=users,dc=github,dc=com
56+
member: cn=group1.1.1,ou=groups,dc=github,dc=com
57+
58+
dn: cn=group1.1.1,ou=groups,dc=github,dc=com
59+
cn: group1
60+
objectClass: groupOfNames
61+
member: uid=user1.1.1,ou=users,dc=github,dc=com
62+
member: cn=group1.1.1.1,ou=groups,dc=github,dc=com
63+
64+
dn: cn=group1.1.1.1,ou=groups,dc=github,dc=com
65+
cn: group1
66+
objectClass: groupOfNames
67+
member: cn=user1.1.1.1,ou=users,dc=github,dc=com
68+
4669
# Users
4770

4871
dn: ou=users,dc=github,dc=com
@@ -89,3 +112,35 @@ uid: mtodd
89112
userPassword: passworD1
90113
mail: mtodd@github.com
91114
objectClass: inetOrgPerson
115+
116+
dn: uid=user1,ou=users,dc=github,dc=com
117+
uid: user1
118+
sn: user1
119+
cn: user1
120+
userPassword: passworD1
121+
mail: user1@github.com
122+
objectClass: inetOrgPerson
123+
124+
dn: uid=user1.1,ou=users,dc=github,dc=com
125+
uid: user1.1
126+
sn: user1.1
127+
cn: user1.1
128+
userPassword: passworD1
129+
mail: user1.1@github.com
130+
objectClass: inetOrgPerson
131+
132+
dn: uid=user1.1.1,ou=users,dc=github,dc=com
133+
uid: user1.1.1
134+
sn: user1.1.1
135+
cn: user1.1.1
136+
userPassword: passworD1
137+
mail: user1.1.1@github.com
138+
objectClass: inetOrgPerson
139+
140+
dn: uid=user1.1.1.1,ou=users,dc=github,dc=com
141+
uid: user1.1.1.1
142+
sn: user1.1.1.1
143+
cn: user1.1.1.1
144+
userPassword: passworD1
145+
mail: user1.1.1.1@github.com
146+
objectClass: inetOrgPerson

0 commit comments

Comments
 (0)
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