summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/baseldap.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/plugins/baseldap.py')
-rw-r--r--ipalib/plugins/baseldap.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index cf26a9517..46a98643e 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -708,6 +708,17 @@ class LDAPUpdate(LDAPQuery, crud.Update):
has_output_params = global_output_params
+ def _get_rename_option(self):
+ rdnparam = getattr(self.obj.params, self.obj.rdnattr)
+ return rdnparam.clone_rename('rename', cli_name='rename',
+ doc=_('Rename the %s object' % self.obj.object_name))
+
+ def get_options(self):
+ for option in super(LDAPUpdate, self).get_options():
+ yield option
+ if self.obj.rdnattr:
+ yield self._get_rename_option()
+
def execute(self, *keys, **options):
ldap = self.obj.backend
@@ -768,6 +779,9 @@ class LDAPUpdate(LDAPQuery, crud.Update):
rdnupdate = False
try:
+ if self.obj.rdnattr and 'rename' in options:
+ entry_attrs[self.obj.rdnattr] = options['rename']
+
if self.obj.rdnattr and self.obj.rdnattr in entry_attrs:
# RDN change
ldap.update_entry_rdn(dn, unicode('%s=%s' % (self.obj.rdnattr,