Module: ActiveLdap::Operations::Delete
- Defined in:
- lib/active_ldap/operations.rb
Instance Method Summary collapse
- #delete_all(options_or_filter = nil, deprecated_options = nil) ⇒ Object
- #delete_entry(dn, options = {}) ⇒ Object
- #destroy_all(options_or_filter = nil, deprecated_options = nil) ⇒ Object
Instance Method Details
#delete_all(options_or_filter = nil, deprecated_options = nil) ⇒ Object
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/active_ldap/operations.rb', line 530 def delete_all(=nil, =nil) if .nil? if .is_a?(String) = {:filter => } else = ( || {}).dup end else = .merge(:filter => ) end targets = search().collect do |dn, attributes| dn end.sort_by do |dn| dn.upcase.reverse end.reverse delete_entry(targets, ) end |
#delete_entry(dn, options = {}) ⇒ Object
549 550 551 552 553 554 555 556 557 |
# File 'lib/active_ldap/operations.rb', line 549 def delete_entry(dn, ={}) [:connection] ||= connection begin [:connection].delete(dn, ) rescue Error format = _("Failed to delete LDAP entry: <%s>: %s") raise DeleteError.new(format % [dn.inspect, $!.]) end end |
#destroy_all(options_or_filter = nil, deprecated_options = nil) ⇒ Object
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
# File 'lib/active_ldap/operations.rb', line 512 def destroy_all(=nil, =nil) if .nil? if .is_a?(String) = {:filter => } else = ( || {}).dup end else = .merge(:filter => ) end find(:all, ).sort_by do |target| target.dn end.each do |target| target.destroy end end |