From d6d579ead469e0b4690d6d1eec0f137dd3c40940 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Tue, 4 Jan 2011 15:15:54 -0500 Subject: Improve filtering of enrollments search results. This is required for effective filtering of enrollments search results in the webUI and also gives an edge to the CLI. After this patch, each LDAPObject can define its relationships to other LDAPObjects. For now, this is used only for filtering search results by enrollments, but there are probably more benefits to come. You can do this for example: # search for all users not enrolled in group admins ipa user-find --not-in-groups=admins # search for all groups not enrolled in group global with user Pavel ipa group-find --users=Pavel --not-in-groups=global # more examples: ipa group-find --users=Pavel,Jakub --no-users=Honza ipa hostgroup-find --hosts=webui.pzuna --- ipalib/plugins/host.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ipalib/plugins/host.py') diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py index 283c2c16..e24da1bf 100644 --- a/ipalib/plugins/host.py +++ b/ipalib/plugins/host.py @@ -170,6 +170,11 @@ class host(LDAPObject): 'managedby': ['host'], } bindable = True + relationships = { + 'memberof': ('Parent', 'in_', 'not_in_'), + 'enrolledby': ('Enrolled by', 'enroll_by_', 'not_enroll_by_'), + 'managedby': ('Managed by', 'man_by_', 'not_man_by_'), + } label = _('Hosts') @@ -568,7 +573,7 @@ class host_find(LDAPSearch): msg_summary = ngettext( '%(count)d host matched', '%(count)d hosts matched' ) - member_attributes = ['managedby'] + member_attributes = ['memberof', 'enrolledby', 'managedby'] def pre_callback(self, ldap, filter, attrs_list, base_dn, scope, *args, **options): if 'locality' in attrs_list: -- cgit