summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-12-05 18:18:32 +0100
committerMartin Kosek <mkosek@redhat.com>2013-12-13 15:08:52 +0100
commit7fc35ced1d83d9901f4a1bf59482c3c4666d6079 (patch)
tree18ccbbc269fc59f6b8e88b994ba251933d583289 /ipalib/plugins
parent53caa7aca21b097e1ca975c1c4b4e7038558bc9b (diff)
downloadfreeipa-7fc35ced1d83d9901f4a1bf59482c3c4666d6079.tar.gz
freeipa-7fc35ced1d83d9901f4a1bf59482c3c4666d6079.tar.xz
freeipa-7fc35ced1d83d9901f4a1bf59482c3c4666d6079.zip
permission plugin: Ensure ipapermlocation (subtree) always exists
Diffstat (limited to 'ipalib/plugins')
-rw-r--r--ipalib/plugins/permission.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py
index da1c41d65..f3f001b74 100644
--- a/ipalib/plugins/permission.py
+++ b/ipalib/plugins/permission.py
@@ -623,6 +623,16 @@ class permission(baseldap.LDAPObject):
name='ipapermtargetfilter',
error=_('Bad search filter'))
+ # Ensure location exists
+ if entry.get('ipapermlocation'):
+ location = DN(entry.single_value['ipapermlocation'])
+ try:
+ ldap.get_entry(location, attrs_list=[])
+ except errors.NotFound:
+ raise errors.ValidationError(
+ name='ipapermlocation',
+ error=_('Entry %s does not exist') % location)
+
# Ensure there's something in the ACI's filter
needed_attrs = (
'ipapermtarget', 'ipapermtargetfilter', 'ipapermallowedattr')