summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-06-16 16:51:31 +0200
committerMartin Kosek <mkosek@redhat.com>2014-06-18 12:59:25 +0200
commit637ef11109600d87bfb783eadd4b6401fa58d468 (patch)
tree1e2d013dd51e5178f2a11edca7aff6fccfe77e91 /ipalib
parentd868fc5566da547d2060ef4a42eb5a0d0e0a72d6 (diff)
downloadfreeipa-637ef11109600d87bfb783eadd4b6401fa58d468.tar.gz
freeipa-637ef11109600d87bfb783eadd4b6401fa58d468.tar.xz
freeipa-637ef11109600d87bfb783eadd4b6401fa58d468.zip
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>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/sudorule.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ipalib/plugins/sudorule.py b/ipalib/plugins/sudorule.py
index 9c2e7c51e..04ca97eff 100644
--- a/ipalib/plugins/sudorule.py
+++ b/ipalib/plugins/sudorule.py
@@ -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(