Ensuring a 404 is returned when we can't find the specified certificate

This commit is contained in:
Kevin Glisson 2015-06-26 16:17:22 -07:00 committed by kevgliss
parent 7ab3e27c79
commit 096d88bc9b
1 changed files with 3 additions and 0 deletions

View File

@ -437,6 +437,9 @@ class CertificatePrivateKey(AuthenticatedResource):
:statuscode 403: unauthenticated
"""
cert = service.get(certificate_id)
if not cert:
return dict(message="Cannot find specified certificate"), 404
role = role_service.get_by_name(cert.owner)
permission = ViewKeyPermission(certificate_id, hasattr(role, 'id'))