summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-08-30 17:10:27 +0200
committerRob Crittenden <rcritten@redhat.com>2011-08-29 21:27:08 -0400
commit3a355c3b78ba6762a2c2e214616454390913787d (patch)
tree90fe457983c079bc5dcc47ed72aea69fc88ffb95 /ipalib
parent7aaadf74f18f954ce455fdc4fdaa0c95070ab149 (diff)
downloadfreeipa-3a355c3b78ba6762a2c2e214616454390913787d.zip
freeipa-3a355c3b78ba6762a2c2e214616454390913787d.tar.gz
freeipa-3a355c3b78ba6762a2c2e214616454390913787d.tar.xz
Fix sudo help and summaries
1) Add sudorule docstring headline 2) Fix naming inconsistency in Sudo plugins help and summaries, especially capitalization of Sudo objects - Sudo Rule, Sudo Command and Sudo Command Group 3) Add missing summaries for sudorule-add-option and sudorule-remove-option. To keep backward compatibility with older clients, just print the missing summary with output_for_cli(), don't expand Output. https://fedorahosted.org/freeipa/ticket/1595 https://fedorahosted.org/freeipa/ticket/1596
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/sudocmd.py18
-rw-r--r--ipalib/plugins/sudocmdgroup.py40
-rw-r--r--ipalib/plugins/sudorule.py40
3 files changed, 55 insertions, 43 deletions
diff --git a/ipalib/plugins/sudocmd.py b/ipalib/plugins/sudocmd.py
index 18190f9..42068ed 100644
--- a/ipalib/plugins/sudocmd.py
+++ b/ipalib/plugins/sudocmd.py
@@ -97,36 +97,36 @@ class sudocmd(LDAPObject):
api.register(sudocmd)
class sudocmd_add(LDAPCreate):
- __doc__ = _('Create new sudo command.')
+ __doc__ = _('Create new Sudo Command.')
- msg_summary = _('Added sudo command "%(value)s"')
+ msg_summary = _('Added Sudo Command "%(value)s"')
api.register(sudocmd_add)
class sudocmd_del(LDAPDelete):
- __doc__ = _('Delete sudo command.')
+ __doc__ = _('Delete Sudo Command.')
- msg_summary = _('Deleted sudo command "%(value)s"')
+ msg_summary = _('Deleted Sudo Command "%(value)s"')
api.register(sudocmd_del)
class sudocmd_mod(LDAPUpdate):
- __doc__ = _('Modify command.')
+ __doc__ = _('Modify Sudo Command.')
- msg_summary = _('Modified sudo command "%(value)s"')
+ msg_summary = _('Modified Sudo Command "%(value)s"')
api.register(sudocmd_mod)
class sudocmd_find(LDAPSearch):
- __doc__ = _('Search for commands.')
+ __doc__ = _('Search for Sudo Commands.')
msg_summary = ngettext(
- '%(count)d sudo command matched', '%(count)d sudo command matched', 0
+ '%(count)d Sudo Command matched', '%(count)d Sudo Commands matched', 0
)
api.register(sudocmd_find)
class sudocmd_show(LDAPRetrieve):
- __doc__ = _('Display sudo command.')
+ __doc__ = _('Display Sudo Command.')
api.register(sudocmd_show)
diff --git a/ipalib/plugins/sudocmdgroup.py b/ipalib/plugins/sudocmdgroup.py
index e7f1fd3..2124b84 100644
--- a/ipalib/plugins/sudocmdgroup.py
+++ b/ipalib/plugins/sudocmdgroup.py
@@ -23,25 +23,25 @@ from ipalib.plugins.baseldap import *
from ipalib import _, ngettext
__doc__ = _("""
-Groups of Sudo commands
+Groups of Sudo Commands
-Manage groups of Sudo commands.
+Manage groups of Sudo Commands.
EXAMPLES:
- Add a new Sudo command group:
+ Add a new Sudo Command Group:
ipa sudocmdgroup-add --desc='administrators commands' admincmds
- Remove a Sudo command group:
+ Remove a Sudo Command Group:
ipa sudocmdgroup-del admincmds
- Manage Sudo command group membership, commands:
+ Manage Sudo Command Group membership, commands:
ipa sudocmdgroup-add-member --sudocmds=/usr/bin/less,/usr/bin/vim admincmds
- Manage Sudo command group membership, commands:
+ Manage Sudo Command Group membership, commands:
ipa group-remove-member --sudocmds=/usr/bin/less admincmds
- Show a Sudo command group:
+ Show a Sudo Command Group:
ipa group-show localadmins
""")
@@ -49,7 +49,7 @@ topic = ('sudo', _('commands for controlling sudo configuration'))
class sudocmdgroup(LDAPObject):
"""
- Sudo Group object.
+ Sudo Command Group object.
"""
container_dn = api.env.container_sudocmdgroup
object_name = _('sudo command group')
@@ -92,53 +92,53 @@ api.register(sudocmdgroup)
class sudocmdgroup_add(LDAPCreate):
- __doc__ = _('Create new sudo command group.')
+ __doc__ = _('Create new Sudo Command Group.')
- msg_summary = _('Added sudo command group "%(value)s"')
+ msg_summary = _('Added Sudo Command Group "%(value)s"')
api.register(sudocmdgroup_add)
class sudocmdgroup_del(LDAPDelete):
- __doc__ = _('Delete sudo command group.')
+ __doc__ = _('Delete Sudo Command Group.')
- msg_summary = _('Deleted sudo command group "%(value)s"')
+ msg_summary = _('Deleted Sudo Command Group "%(value)s"')
api.register(sudocmdgroup_del)
class sudocmdgroup_mod(LDAPUpdate):
- __doc__ = _('Modify group.')
+ __doc__ = _('Modify Sudo Command Group.')
- msg_summary = _('Modified sudo command group "%(value)s"')
+ msg_summary = _('Modified Sudo Command Group "%(value)s"')
api.register(sudocmdgroup_mod)
class sudocmdgroup_find(LDAPSearch):
- __doc__ = _('Search for sudo command groups.')
+ __doc__ = _('Search for Sudo Command Groups.')
msg_summary = ngettext(
- '%(count)d sudo command group matched',
- '%(count)d sudo command groups matched', 0
+ '%(count)d Sudo Command Group matched',
+ '%(count)d Sudo Command Groups matched', 0
)
api.register(sudocmdgroup_find)
class sudocmdgroup_show(LDAPRetrieve):
- __doc__ = _('Display sudo command group.')
+ __doc__ = _('Display Sudo Command Group.')
api.register(sudocmdgroup_show)
class sudocmdgroup_add_member(LDAPAddMember):
- __doc__ = _('Add members to sudo command group.')
+ __doc__ = _('Add members to Sudo Command Group.')
api.register(sudocmdgroup_add_member)
class sudocmdgroup_remove_member(LDAPRemoveMember):
- __doc__ = _('Remove members from sudo command group.')
+ __doc__ = _('Remove members from Sudo Command Group.')
api.register(sudocmdgroup_remove_member)
diff --git a/ipalib/plugins/sudorule.py b/ipalib/plugins/sudorule.py
index a169452..ddb0bd5 100644
--- a/ipalib/plugins/sudorule.py
+++ b/ipalib/plugins/sudorule.py
@@ -23,6 +23,8 @@ from ipalib.plugins.baseldap import *
from ipalib import _, ngettext
__doc__ = _("""
+Sudo Rules
+
Sudo (su "do") allows a system administrator to delegate authority to
give certain users (or groups of users) the ability to run some (or all)
commands as root or another user while providing an audit trail of the
@@ -64,7 +66,7 @@ def validate_runasextgroup(ugettext, value):
class sudorule(LDAPObject):
"""
- Sudo Rule management
+ Sudo Rule object.
"""
container_dn = api.env.container_sudorule
object_name = _('sudo rule')
@@ -208,11 +210,11 @@ class sudorule_add(LDAPCreate):
__doc__ = _('Create new Sudo Rule.')
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
- # Sudo rules are enabled by default
+ # Sudo Rules are enabled by default
entry_attrs['ipaenabledflag'] = 'TRUE'
return dn
- msg_summary = _('Added sudo rule "%(value)s"')
+ msg_summary = _('Added Sudo Rule "%(value)s"')
api.register(sudorule_add)
@@ -220,7 +222,7 @@ api.register(sudorule_add)
class sudorule_del(LDAPDelete):
__doc__ = _('Delete Sudo Rule.')
- msg_summary = _('Deleted sudo rule "%(value)s"')
+ msg_summary = _('Deleted Sudo Rule "%(value)s"')
api.register(sudorule_del)
@@ -228,7 +230,7 @@ api.register(sudorule_del)
class sudorule_mod(LDAPUpdate):
__doc__ = _('Modify Sudo Rule.')
- msg_summary = _('Modified sudo rule "%(value)s"')
+ msg_summary = _('Modified Sudo Rule "%(value)s"')
api.register(sudorule_mod)
@@ -237,7 +239,7 @@ class sudorule_find(LDAPSearch):
__doc__ = _('Search for Sudo Rule.')
msg_summary = ngettext(
- '%(count)d sudo rule matched', '%(count)d sudo rules matched', 0
+ '%(count)d Sudo Rule matched', '%(count)d Sudo Rules matched', 0
)
api.register(sudorule_find)
@@ -250,7 +252,7 @@ api.register(sudorule_show)
class sudorule_enable(LDAPQuery):
- __doc__ = _('Enable a Sudo rule.')
+ __doc__ = _('Enable a Sudo Rule.')
def execute(self, cn):
ldap = self.obj.backend
@@ -268,14 +270,13 @@ class sudorule_enable(LDAPQuery):
return dict(result=True)
def output_for_cli(self, textui, result, cn):
- textui.print_name(self.name)
- textui.print_dashed('Enabled Sudo rule "%s".' % cn)
+ textui.print_dashed(_('Enabled Sudo Rule "%s"') % cn)
api.register(sudorule_enable)
class sudorule_disable(LDAPQuery):
- __doc__ = _('Disable a Sudo rule.')
+ __doc__ = _('Disable a Sudo Rule.')
def execute(self, cn):
ldap = self.obj.backend
@@ -293,8 +294,7 @@ class sudorule_disable(LDAPQuery):
return dict(result=True)
def output_for_cli(self, textui, result, cn):
- textui.print_name(self.name)
- textui.print_dashed('Disabled Sudo rule "%s".' % cn)
+ textui.print_dashed(_('Disabled Sudo Rule "%s"') % cn)
api.register(sudorule_disable)
@@ -609,7 +609,7 @@ api.register(sudorule_remove_runasgroup)
class sudorule_add_option(LDAPQuery):
- __doc__ = _('Add an option to the Sudo rule.')
+ __doc__ = _('Add an option to the Sudo Rule.')
takes_options = (
Str('ipasudoopt',
@@ -650,11 +650,18 @@ class sudorule_add_option(LDAPQuery):
return dict(result=entry_attrs)
+ def output_for_cli(self, textui, result, cn, **options):
+ textui.print_dashed(_('Added option "%s" to Sudo Rule "%s"') % \
+ (options['ipasudoopt'], cn))
+ super(sudorule_add_option, self).output_for_cli(textui, result, cn, options)
+
+
+
api.register(sudorule_add_option)
class sudorule_remove_option(LDAPQuery):
- __doc__ = _('Remove an option from Sudo rule.')
+ __doc__ = _('Remove an option from Sudo Rule.')
takes_options = (
Str('ipasudoopt',
@@ -698,4 +705,9 @@ class sudorule_remove_option(LDAPQuery):
return dict(result=entry_attrs)
+ def output_for_cli(self, textui, result, cn, **options):
+ textui.print_dashed(_('Removed option "%s" from Sudo Rule "%s"') % \
+ (options['ipasudoopt'], cn))
+ super(sudorule_remove_option, self).output_for_cli(textui, result, cn, options)
+
api.register(sudorule_remove_option)