Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ldap-filter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldap-filter

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

ldap-filter

While working on a Rails application that leaned heavily on my school's LDAP server, I started off writing inflexible methods like:

def uid_filter(uid)
  "(uid=#{uid})"
end

def uid_or_email_filter(uid, email)
  "(|(#{uid_filter(uid)})(#{email_filter(email)}))"
end

And decided it would be easier to do:

filter = LDAP::Filter::Base.new :uid, 'mrhalp' # (uid=mrhalp)
if search[:email] # mrhalp@email.org
  email = LDAP::Filter::Base.new :mail, search[:email]
  filter = filter | email
end
MyLDAPLibrary.search filter.to_s # (|(email=mrhalp@email.org)(uid=mrhalp))

You also don't have to worry about all those nested parentheses.

Install

gem install ldap-filter

With Bundler:

gem 'ldap-filter'

Usage

More to come soon.

FAQs

Package last updated on 13 Mar 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc