lib/portus/ldap/connection.rb
# Returns a hash with the search options to be applied.
Returns a hash with the search options to be applied.
Returns a hash with the search options to be applied .
def search_options(cfg)
        uid = APP_CONFIG["ldap"]["uid"]
        filter = Net::LDAP::Filter.equals(uid, cfg.username)
        provided = APP_CONFIG["ldap"]["filter"]
        if provided.present?
          provided_filter = Net::LDAP::Filter.construct(provided)
          filter = Net::LDAP::Filter.join(filter, provided_filter)
        end
        {}.tap do |opts|
          opts[:filter] = filter
          opts[:base]   = APP_CONFIG["ldap"]["base"] unless APP_CONFIG["ldap"]["base"].empty?
        end
      end
def search_options ( cfg ) uid = APP_CONFIG [ "ldap" ] [ "uid" ] filter = Net :: LDAP :: Filter . equals ( uid , cfg . username ) provided = APP_CONFIG [ "ldap" ] [ "filter" ] if provided . present? provided_filter = Net :: LDAP :: Filter . construct ( provided ) filter = Net :: LDAP :: Filter . join ( filter , provided_filter ) end { } . tap do | opts | opts [ :filter ] = filter opts [ :base ] = APP_CONFIG [ "ldap" ] [ "base" ] unless APP_CONFIG [ "ldap" ] [ "base" ] . empty? end end
Returns a hash with the search options to be applied.
Returns a hash with the search options to be applied .
# Filter for uid. # Possibly add an optional filter.
cfg