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
parent c8cbc82062
commit 1f9d943a4c
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'))