diff options
author | Tomas Babej <tbabej@redhat.com> | 2014-09-11 13:09:44 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2014-09-30 10:42:06 +0200 |
commit | c1f51cff02b0ca1bb41447134c77e5f09544b114 (patch) | |
tree | 140987cebc2255f15a3b312aad14362f147ffa12 | |
parent | 961790e20a102b6e70a4b83cccd99d1bf24c499e (diff) | |
download | freeipa-c1f51cff02b0ca1bb41447134c77e5f09544b114.tar.gz freeipa-c1f51cff02b0ca1bb41447134c77e5f09544b114.tar.xz freeipa-c1f51cff02b0ca1bb41447134c77e5f09544b114.zip |
idviews: Raise NotFound errors if object to override could not be found
If the object user wishes to override cannot be found, we should properly raise a
NotFound error.
Part of: https://fedorahosted.org/freeipa/ticket/3979
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
-rw-r--r-- | ipalib/plugins/idviews.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ipalib/plugins/idviews.py b/ipalib/plugins/idviews.py index 098e71b2f..712e51bf0 100644 --- a/ipalib/plugins/idviews.py +++ b/ipalib/plugins/idviews.py @@ -439,6 +439,9 @@ class baseidoverride(LDAPObject): # about the domain return SID_ANCHOR_PREFIX + sid + # No acceptable object was found + api.Object['idoverride%s' % obj_type].handle_not_found(obj) + def resolve_anchor_to_object_name(self, anchor): if anchor.startswith(IPA_ANCHOR_PREFIX): @@ -477,6 +480,10 @@ class baseidoverride(LDAPObject): name = domain_validator.get_trusted_domain_object_from_sid(sid) return name + # No acceptable object was found + raise errors.NotFound( + reason=_("Anchor '%(anchor)s' could not be resolved.") + % dict(anchor=anchor)) def get_dn(self, *keys, **options): keys = keys[:-1] + (self.resolve_object_to_anchor(keys[-1]), ) |