Module: ActiveLdap::Operations::Delete
- Defined in:
- lib/active_ldap/operations.rb
Instance Method Summary collapse
- #delete(targets, options = {}) ⇒ Object
- #delete_all(filter = nil, options = {}) ⇒ Object
- #destroy(targets, options = {}) ⇒ Object
- #destroy_all(filter = nil, options = {}) ⇒ Object
Instance Method Details
#delete(targets, options = {}) ⇒ Object
339 340 341 342 343 344 345 346 |
# File 'lib/active_ldap/operations.rb', line 339 def delete(targets, ={}) targets = [targets] unless targets.is_a?(Array) targets = targets.collect do |target| ensure_dn_attribute(ensure_base(target)) end conn = [:connection] || connection conn.delete(targets, ) end |
#delete_all(filter = nil, options = {}) ⇒ Object
348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/active_ldap/operations.rb', line 348 def delete_all(filter=nil, ={}) = {:base => base, :scope => scope}.merge() = .merge(:filter => filter) if filter conn = [:connection] || connection targets = conn.search().collect do |dn, attributes| dn end.sort_by do |dn| dn.upcase.reverse end.reverse conn.delete(targets) end |
#destroy(targets, options = {}) ⇒ Object
318 319 320 321 322 323 |
# File 'lib/active_ldap/operations.rb', line 318 def destroy(targets, ={}) targets = [targets] unless targets.is_a?(Array) targets.each do |target| find(target, ).destroy end end |
#destroy_all(filter = nil, options = {}) ⇒ Object
325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/active_ldap/operations.rb', line 325 def destroy_all(filter=nil, ={}) targets = [] if filter.is_a?(Hash) = .merge(filter) filter = nil end = .merge(:filter => filter) if filter find(:all, ).sort_by do |target| target.dn.reverse end.reverse.each do |target| target.destroy end end |