-
Notifications
You must be signed in to change notification settings - Fork 27
Membership Validators #45
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
Conversation
How could I forget.
# | ||
# Returns a Net::LDAP::Filter. | ||
def member_filter(entry = nil) | ||
if entry | ||
entry = entry.dn if entry.respond_to?(:dn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better variable name here might be dn
since you extract it from an entry. Also, what do you think of making the parameter name entry_or_dn
to reflect it accepting two types?
Made a first pass with an emphasis towards code quality and how the interface will be used. Overall, the idea feels pretty natural to me. Let me know if I'm totally off base b/c of missing context. |
Didn't match DN so resulted in false positives.
@jch cleaned up the diff based on your feedback, looking into a few more test and docs tweaks, but want to get this merged into |
👍 Merge at will |
This introduces
GitHub::Ldap::MembershipValidators
as an extraction of behavior focused on validating that an entry is a member of a list of groups.The goal here is to encapsulate a single operation, membership validation, into efficient, standalone objects for reuse. Each strategy,
Classic
(what's already available today withDomain#is_member?
),Recursive
(an optimized approach), and more to come (likeActiveDirectory
which could use matching rule in chain (1.2.840.113556.1.4.1941
)) should be drop-in-replacements for each other, allowing you to pick the one most suited to your needs and environment.member
attribute inRecursive
strategyI'll follow up with the
ActiveDirectory
strategy et al in other PRs.cc @jch @github/ldap