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 <pspacek@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Basti 2016-05-13 16:19:51 +02:00
parent 7c3bcafef0
commit 121e34b90e

View File

@ -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):