From 121e34b90e890285c480a0c89e833d1369d61401 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Jun 03 2016 13:58:21 +0000 Subject: Allow to use non-Str attributes as keys for members Locations use DNSNameParam as pkey_value, but implementation of searches for members was able to use only Str param. This commit allows to use other param classes for search. Required for: https://fedorahosted.org/freeipa/ticket/2008 Reviewed-By: Petr Spacek Reviewed-By: Jan Cholasta --- diff --git a/ipaserver/plugins/baseldap.py b/ipaserver/plugins/baseldap.py index bbd8ba1..62b726d 100644 --- a/ipaserver/plugins/baseldap.py +++ b/ipaserver/plugins/baseldap.py @@ -1890,9 +1890,10 @@ class LDAPSearch(BaseLDAPCommand, crud.Search): ldap_object=ldap_obj.object_name_plural ) name = '%s%s' % (relationship[1], to_cli(ldap_obj_name)) - yield Str( - '%s*' % name, cli_name='%ss' % name, doc=doc, - label=ldap_obj.object_name + yield ldap_obj.primary_key.clone_rename( + '%s' % name, cli_name='%ss' % name, doc=doc, + label=ldap_obj.object_name, multivalue=True, query=True, + required=False, primary_key=False ) doc = self.member_param_excl_doc % dict( searched_object=self.obj.object_name_plural, @@ -1900,9 +1901,10 @@ class LDAPSearch(BaseLDAPCommand, crud.Search): ldap_object=ldap_obj.object_name_plural ) name = '%s%s' % (relationship[2], to_cli(ldap_obj_name)) - yield Str( - '%s*' % name, cli_name='%ss' % name, doc=doc, - label=ldap_obj.object_name + yield ldap_obj.primary_key.clone_rename( + '%s' % name, cli_name='%ss' % name, doc=doc, + label=ldap_obj.object_name, multivalue=True, query=True, + required=False, primary_key=False ) def get_options(self):