From f777f72de6a7c1d3ef29088fbf89722c1148f246 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 16 Oct 2008 15:00:30 -0400 Subject: Use the search fields from the configuration when searching Generalize the attribute -> objectclass search helper --- ipalib/plugins/f_group.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ipalib/plugins/f_group.py') diff --git a/ipalib/plugins/f_group.py b/ipalib/plugins/f_group.py index c2280a4e..132e45ef 100644 --- a/ipalib/plugins/f_group.py +++ b/ipalib/plugins/f_group.py @@ -155,9 +155,20 @@ api.register(group_mod) class group_find(crud.Find): 'Search the groups.' - def execute(self, cn, **kw): + def execute(self, term, **kw): ldap = self.api.Backend.ldap - kw['cn'] = cn + + # Pull the list of searchable attributes out of the configuration. + config = ldap.get_ipa_config() + search_fields_conf_str = config.get('ipagroupsearchfields') + search_fields = search_fields_conf_str.split(",") + + for s in search_fields: + kw[s] = term + + object_type = ldap.get_object_type("cn") + if object_type and not kw.get('objectclass'): + kw['objectclass'] = ldap.get_object_type("cn") return ldap.search(**kw) def output_for_cli(self, groups): -- cgit