diff options
author | Pavel Zuna <pzuna@redhat.com> | 2009-04-21 15:17:07 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-04-22 15:14:24 -0400 |
commit | 9ecbd845d47231c742e46f04c98856ff672fdd81 (patch) | |
tree | 74d1dac3e01d330a2ee8f949ba4ff86bf83f5915 | |
parent | ff0819b189cd9e94c30a050d28e89a28a1aca007 (diff) | |
download | freeipa-9ecbd845d47231c742e46f04c98856ff672fdd81.tar.gz freeipa-9ecbd845d47231c742e46f04c98856ff672fdd81.tar.xz freeipa-9ecbd845d47231c742e46f04c98856ff672fdd81.zip |
Add conditional (env.use_ldap2 is True) modifications required by new LDAP backend.
-rw-r--r-- | ipalib/backend.py | 5 | ||||
-rw-r--r-- | ipalib/frontend.py | 21 |
2 files changed, 19 insertions, 7 deletions
diff --git a/ipalib/backend.py b/ipalib/backend.py index 1902929aa..7bd9a29f8 100644 --- a/ipalib/backend.py +++ b/ipalib/backend.py @@ -98,7 +98,10 @@ class Executioner(Backend): def create_context(self, ccache=None, client_ip=None): if self.env.in_server: - self.Backend.ldap.connect(ccache) + if self.api.env.use_ldap2: + self.Backend.ldap2.connect(ccache=ccache) + else: + self.Backend.ldap.connect(ccache) else: self.Backend.xmlclient.connect() diff --git a/ipalib/frontend.py b/ipalib/frontend.py index db045fe67..c2f68d471 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -184,12 +184,21 @@ class Command(plugable.Plugin): return dict(self.__attributes_2_entry(kw)) def __attributes_2_entry(self, kw): - for name in self.params: - if self.params[name].attribute and name in kw: - if type(kw[name]) is tuple: - yield (name, [str(value) for value in kw[name]]) - else: - yield (name, str(kw[name])) + if self.api.env.use_ldap2: + for name in self.params: + if self.params[name].attribute and name in kw: + value = kw[name] + if isinstance(value, tuple): + yield (name, [v for v in value]) + else: + yield (name, kw[name]) + else: + for name in self.params: + if self.params[name].attribute and name in kw: + if type(kw[name]) is tuple: + yield (name, [str(value) for value in kw[name]]) + else: + yield (name, str(kw[name])) def params_2_args_options(self, **params): """ |