Method: Net::LDAP#delete_tree
- Defined in:
- lib/net/ldap.rb
#delete_tree(args) ⇒ Object
Delete an entry from the LDAP directory along with all subordinate entries. the regular delete method will fail to delete an entry if it has subordinate entries. This method sends an extra control code to tell the LDAP server to do a tree delete. (‘1.2.840.113556.1.4.805’)
If the LDAP server does not support the DELETE_TREE control code, subordinate entries are deleted recursively instead.
Returns True or False to indicate whether the delete succeeded. Extended status information is available by calling #get_operation_result.
dn = "mail=deleteme@example.com, ou=people, dc=example, dc=com"
ldap.delete_tree :dn => dn
1195 1196 1197 1198 1199 1200 1201 |
# File 'lib/net/ldap.rb', line 1195 def delete_tree(args) if search_root_dse[:supportedcontrol].include? Net::LDAP::LDAPControls::DELETE_TREE delete(args.merge(:control_codes => [[Net::LDAP::LDAPControls::DELETE_TREE, true]])) else recursive_delete(args) end end |