Skip to content

Commit e63e2af

Browse files
committed
Short circuit membership valiation without groups to check
Default to true since no groups to validate against translates to existing handling: if no groups to check against, then they are valid members.
1 parent f008a49 commit e63e2af

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

lib/github/ldap/membership_validators/active_directory.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ module MembershipValidators
1515
# nested groups, performed on the server side.
1616
class ActiveDirectory < Base
1717
def perform(entry)
18+
# short circuit validation if there are no groups to check against
19+
return true if groups.empty?
20+
1821
# search for the entry on the condition that the entry is a member
1922
# of one of the groups or their subgroups.
2023
#

lib/github/ldap/membership_validators/classic.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module MembershipValidators
77
# it consistently with the new approach.
88
class Classic < Base
99
def perform(entry)
10+
# short circuit validation if there are no groups to check against
1011
return true if groups.empty?
1112

1213
domains.each do |domain|

lib/github/ldap/membership_validators/recursive.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Recursive < Base
2222
ATTRS = %w(dn cn)
2323

2424
def perform(entry, depth = DEFAULT_MAX_DEPTH)
25+
# short circuit validation if there are no groups to check against
26+
return true if groups.empty?
27+
2528
domains.each do |domain|
2629
# find groups entry is an immediate member of
2730
membership = domain.search(filter: member_filter(entry), attributes: ATTRS)

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