mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Allow renaming of the sudorule objects
The recent changes allow the sudorule objects to be renamed. https://pagure.io/freeipa/issue/2466 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Pavel Vomacka
parent
55424c8677
commit
8c1409155e
3
API.txt
3
API.txt
@@ -5403,7 +5403,7 @@ output: ListOfEntries('result')
|
||||
output: Output('summary', type=[<type 'unicode'>, <type 'NoneType'>])
|
||||
output: Output('truncated', type=[<type 'bool'>])
|
||||
command: sudorule_mod/1
|
||||
args: 1,20,3
|
||||
args: 1,21,3
|
||||
arg: Str('cn', cli_name='sudorule_name')
|
||||
option: Str('addattr*', cli_name='addattr')
|
||||
option: Flag('all', autofill=True, cli_name='all', default=False)
|
||||
@@ -5420,6 +5420,7 @@ option: StrEnum('ipasudorunasgroupcategory?', autofill=False, cli_name='runasgro
|
||||
option: StrEnum('ipasudorunasusercategory?', autofill=False, cli_name='runasusercat', values=[u'all'])
|
||||
option: Flag('no_members', autofill=True, default=False)
|
||||
option: Flag('raw', autofill=True, cli_name='raw', default=False)
|
||||
option: Str('rename?', cli_name='rename')
|
||||
option: Flag('rights', autofill=True, default=False)
|
||||
option: Str('setattr*', cli_name='setattr')
|
||||
option: Int('sudoorder?', autofill=False, cli_name='order', default=0)
|
||||
|
||||
@@ -74,7 +74,7 @@ define(IPA_DATA_VERSION, 20100614120000)
|
||||
########################################################
|
||||
define(IPA_API_VERSION_MAJOR, 2)
|
||||
define(IPA_API_VERSION_MINOR, 224)
|
||||
# Last change: Add rename option to HBAC rule objects
|
||||
# Last change: Add rename option to sudorule objects
|
||||
|
||||
|
||||
########################################################
|
||||
|
||||
@@ -145,6 +145,7 @@ class sudorule(LDAPObject):
|
||||
]
|
||||
uuid_attribute = 'ipauniqueid'
|
||||
rdn_attribute = 'ipauniqueid'
|
||||
allow_rename = True
|
||||
attribute_members = {
|
||||
'memberuser': ['user', 'group'],
|
||||
'memberhost': ['host', 'hostgroup'],
|
||||
|
||||
@@ -42,6 +42,7 @@ class test_sudorule(XMLRPC_test):
|
||||
"""
|
||||
rule_name = u'testing_sudorule1'
|
||||
rule_name2 = u'testing_sudorule2'
|
||||
rule_renamed = u'testing_mega_sudorule'
|
||||
rule_command = u'/usr/bin/testsudocmd1'
|
||||
rule_desc = u'description'
|
||||
rule_desc_mod = u'description modified'
|
||||
@@ -782,6 +783,19 @@ class test_sudorule(XMLRPC_test):
|
||||
api.Command['sudorule_mod'](self.rule_name, sudoorder=None)
|
||||
api.Command['sudorule_mod'](self.rule_name2, sudoorder=None)
|
||||
|
||||
def test_l_1_sudorule_rename(self):
|
||||
"""
|
||||
Test renaming an HBAC rule, rename it back afterwards
|
||||
"""
|
||||
api.Command['sudorule_mod'](
|
||||
self.rule_name, rename=self.rule_renamed
|
||||
)
|
||||
entry = api.Command['sudorule_show'](self.rule_renamed)['result']
|
||||
assert_attr_equal(entry, 'cn', self.rule_renamed)
|
||||
# clean up by renaming the rule back
|
||||
api.Command['sudorule_mod'](
|
||||
self.rule_renamed, rename=self.rule_name
|
||||
)
|
||||
|
||||
def test_m_sudorule_del(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user