590d18
From 8cd08a619b275155e21d71c1368a73c8814a8640 Mon Sep 17 00:00:00 2001
590d18
From: Jan Cholasta <jcholast@redhat.com>
590d18
Date: Thu, 17 Sep 2015 11:14:54 +0200
590d18
Subject: [PATCH] baseldap: make subtree deletion optional in LDAPDelete
590d18
590d18
https://fedorahosted.org/freeipa/ticket/5250
590d18
590d18
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
590d18
---
590d18
 ipalib/plugins/baseldap.py | 4 ++++
590d18
 1 file changed, 4 insertions(+)
590d18
590d18
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
590d18
index 31f38946afcbb51638bcab68a6e74ec309eba0e4..15b6bb2365705bb6b0dc0df258c6a5b59c4b7d8d 100644
590d18
--- a/ipalib/plugins/baseldap.py
590d18
+++ b/ipalib/plugins/baseldap.py
590d18
@@ -1565,6 +1565,8 @@ class LDAPDelete(LDAPMultiQuery):
590d18
 
590d18
     has_output_params = global_output_params
590d18
 
590d18
+    subtree_delete = True
590d18
+
590d18
     def execute(self, *keys, **options):
590d18
         ldap = self.obj.backend
590d18
 
590d18
@@ -1600,6 +1602,8 @@ class LDAPDelete(LDAPMultiQuery):
590d18
             except errors.NotFound:
590d18
                 self.obj.handle_not_found(*nkeys)
590d18
             except errors.NotAllowedOnNonLeaf:
590d18
+                if not self.subtree_delete:
590d18
+                    raise
590d18
                 # this entry is not a leaf entry, delete all child nodes
590d18
                 delete_subtree(dn)
590d18
 
590d18
-- 
590d18
2.4.3
590d18