Skip to content

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

Merged
merged 23 commits into from
Sep 27, 2014
Merged

Membership Validators #45

merged 23 commits into from
Sep 27, 2014

Conversation

mtodd
Copy link
Member

@mtodd mtodd commented Sep 24, 2014

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 with Domain#is_member?), Recursive (an optimized approach), and more to come (like ActiveDirectory 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.

  • fix hardcoded member attribute in Recursive strategy
  • tests
  • docs

I'll follow up with the ActiveDirectory strategy et al in other PRs.

cc @jch @github/ldap

#
# Returns a Net::LDAP::Filter.
def member_filter(entry = nil)
if entry
entry = entry.dn if entry.respond_to?(:dn)
Copy link
Contributor

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?

@jch
Copy link
Contributor

jch commented Sep 24, 2014

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.

@mtodd
Copy link
Member Author

mtodd commented Sep 26, 2014

@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 dev-v2 and keep iterating.

@jch
Copy link
Contributor

jch commented Sep 27, 2014

👍 Merge at will

mtodd added a commit that referenced this pull request Sep 27, 2014
@mtodd mtodd merged commit 7ae8fec into dev-v2 Sep 27, 2014
@mtodd mtodd deleted the membership-validators branch September 27, 2014 00:14
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
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