Module: ActiveLdap::Operations::LDIF — activeldap - ActiveLdap

Module: ActiveLdap::Operations::LDIF

Defined in:
lib/active_ldap/operations.rb

Defined Under Namespace

Modules: AddRecordLoadable, ContentRecordLoadable, DeleteRecordLoadable, ModifyNameRecordLoadable, ModifyRecordLoadable

Instance Method Summary (collapse)

Instance Method Details

- (Object) dump(options = {})



388
389
390
391
392
393
394
395
396
397
# File 'lib/active_ldap/operations.rb', line 388

def dump(options={})
  ldif = Ldif.new
  options = {:base => base, :scope => scope}.merge(options)
  options[:connection] ||= connection
  options[:connection].search(options) do |dn, attributes|
    ldif << Ldif::Record.new(dn, attributes)
  end
  return "" if ldif.records.empty?
  ldif.to_s
end

- (Object) load(ldif, options = {})



407
408
409
410
411
412
# File 'lib/active_ldap/operations.rb', line 407

def load(ldif, options={})
  return if ldif.blank?
  Ldif.parse(ldif).each do |record|
    record.load(self, options)
  end
end

- (Object) to_ldif(dn, attributes)



403
404
405
# File 'lib/active_ldap/operations.rb', line 403

def to_ldif(dn, attributes)
  Ldif.new([to_ldif_record(dn, attributes)]).to_s
end

- (Object) to_ldif_record(dn, attributes)



399
400
401
# File 'lib/active_ldap/operations.rb', line 399

def to_ldif_record(dn, attributes)
  Ldif::Record.new(dn, attributes)
end