module ActiveLdap::Operations::Common

Constants

VALID_SEARCH_OPTIONS

Public Instance Methods

count(options={}) click to toggle source
# File lib/active_ldap/operations.rb, line 112
def count(options={})
  search(options).size
end
exist?(dn, options={}) click to toggle source
# File lib/active_ldap/operations.rb, line 88
def exist?(dn, options={})
  attr, value, prefix = split_search_value(dn)

  options_for_leaf = {
    :attribute => attr,
    :value => value,
    :prefix => prefix,
    :limit => 1,
  }

  attribute = attr || ensure_search_attribute
  options_for_non_leaf = {
    :attribute => attr,
    :value => value,
    :prefix => ["#{attribute}=#{value}", prefix].compact.join(","),
    :limit => 1,
    :scope => :base,
  }

  !search(options_for_leaf.merge(options)).empty? or
    !search(options_for_non_leaf.merge(options)).empty?
end
Also aliased as: exists?
exists?(dn, options={}) click to toggle source
Alias for: exist?