diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-10-16 15:00:30 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-10-16 15:00:30 -0400 |
commit | f777f72de6a7c1d3ef29088fbf89722c1148f246 (patch) | |
tree | 8c79867b165498ed954134da88c3ce2bf1a41e27 /ipalib/plugins/f_group.py | |
parent | 5748fce84ca0c0256183e1da308cb9f7ae4e73de (diff) | |
download | freeipa.git-f777f72de6a7c1d3ef29088fbf89722c1148f246.tar.gz freeipa.git-f777f72de6a7c1d3ef29088fbf89722c1148f246.tar.xz freeipa.git-f777f72de6a7c1d3ef29088fbf89722c1148f246.zip |
Use the search fields from the configuration when searching
Generalize the attribute -> objectclass search helper
Diffstat (limited to 'ipalib/plugins/f_group.py')
-rw-r--r-- | ipalib/plugins/f_group.py | 15 |
1 files changed, 13 insertions, 2 deletions
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): |