summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-03-23 15:13:10 -0400
committerRob Crittenden <rcritten@redhat.com>2009-03-25 11:02:49 -0400
commit1b1f9af01cf27d673039bd8166f4d04d2d91e51a (patch)
treee47daa5b5b009431b8d7a6f82335bff05fb32871 /ipalib
parent5aed824a6c4806ef8ad0d929fd891be6f2c60175 (diff)
downloadfreeipa-1b1f9af01cf27d673039bd8166f4d04d2d91e51a.tar.gz
freeipa-1b1f9af01cf27d673039bd8166f4d04d2d91e51a.tar.xz
freeipa-1b1f9af01cf27d673039bd8166f4d04d2d91e51a.zip
Add a 'showall' command so one can pick from a list of tasks to add to a role
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/taskgroup.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/ipalib/plugins/taskgroup.py b/ipalib/plugins/taskgroup.py
index 863c0a393..f818384af 100644
--- a/ipalib/plugins/taskgroup.py
+++ b/ipalib/plugins/taskgroup.py
@@ -24,7 +24,7 @@ Frontend plugins for taskgroups.
from ipalib import api
from ipalib.plugins.basegroup import *
-display_attributes = ['cn','description', 'member', 'memberof']
+display_attributes = ('cn','description', 'member', 'memberof')
container_taskgroup = "cn=taskgroups,cn=accounts"
container_rolegroup = "cn=rolegroups,cn=accounts"
@@ -72,6 +72,40 @@ class taskgroup_show(basegroup_show):
api.register(taskgroup_show)
+class taskgroup_showall(Command):
+ 'List all taskgroups.'
+ default_attributes = display_attributes
+ container = container_taskgroup
+ takes_args = ()
+
+ def execute(self, **kw):
+ ldap = self.api.Backend.ldap
+
+ search_kw = {"cn": "*"}
+ search_kw['objectclass'] = "groupofnames"
+ search_kw['base'] = self.container
+ search_kw['exactonly'] = True
+ search_kw['attributes'] = ['cn', 'description']
+
+ return ldap.search(**search_kw)
+
+ def output_for_cli(self, textui, result, **options):
+ counter = result[0]
+ groups = result[1:]
+ if counter == 0 or len(groups) == 0:
+ textui.print_plain("No entries found")
+ return
+ for g in groups:
+ textui.print_entry(g)
+ textui.print_plain('')
+ if counter == -1:
+ textui.print_plain("These results are truncated.")
+ textui.print_plain("Please refine your search and try again.")
+ textui.print_count(groups, '%d groups matched')
+
+api.register(taskgroup_showall)
+
+
class taskgroup_add_member(basegroup_add_member):
'Add a member to a taskgroup.'
container = container_taskgroup