diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2010-12-14 11:06:26 +0100 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-12-20 11:27:46 -0500 |
commit | ffc6031ad76c2b28807e45a90b2906bf2e94b914 (patch) | |
tree | e5044bc605844b52ba5fdde6ec5ebf74b570f062 /ipalib/plugins | |
parent | bf778a74a3f750af5a0ebc7f72a0db655d25ef66 (diff) | |
download | freeipa-ffc6031ad76c2b28807e45a90b2906bf2e94b914.tar.gz freeipa-ffc6031ad76c2b28807e45a90b2906bf2e94b914.tar.xz freeipa-ffc6031ad76c2b28807e45a90b2906bf2e94b914.zip |
Allow RDN changes from CLI
https://fedorahosted.org/freeipa/ticket/397
Diffstat (limited to 'ipalib/plugins')
-rw-r--r-- | ipalib/plugins/baseldap.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index cf26a951..46a98643 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, |