mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
sudorule: Allow unsetting sudoorder
After setting sudoorder, you are unable to unset it, since the check for uniqueness of order of sudorules is applied incorrectly. Fix the behaviour and cover it in the test suite. https://fedorahosted.org/freeipa/ticket/4360 Reviewed-By: Martin Kosek <mkosek@redhat.com>
This commit is contained in:
parent
d868fc5566
commit
637ef11109
@ -310,10 +310,11 @@ class sudorule(LDAPObject):
|
||||
)
|
||||
|
||||
def check_order_uniqueness(self, *keys, **options):
|
||||
if 'sudoorder' in options:
|
||||
if options.get('sudoorder') is not None:
|
||||
entries = self.methods.find(
|
||||
sudoorder=options['sudoorder']
|
||||
)['result']
|
||||
|
||||
if len(entries) > 0:
|
||||
rule_name = entries[0]['cn'][0]
|
||||
raise errors.ValidationError(
|
||||
|
@ -769,6 +769,10 @@ class test_sudorule(XMLRPC_test):
|
||||
with assert_raises(errors.ValidationError):
|
||||
api.Command['sudorule_mod'](self.rule_name, sudoorder=0)
|
||||
|
||||
# Try unsetting sudoorder from both rules
|
||||
api.Command['sudorule_mod'](self.rule_name, sudoorder=None)
|
||||
api.Command['sudorule_mod'](self.rule_name2, sudoorder=None)
|
||||
|
||||
|
||||
def test_m_sudorule_del(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user