Projekt

Obecné

Profil

« Předchozí | Další » 

Revize aa740737

Přidáno uživatelem Michal Seják před téměř 4 roky(ů)

Re #8476 - Implemented and tested `get_cert_chain(id)`.

Zobrazit rozdíly:

src/controllers/certificates_controller.py
293 293
        """
294 294
        CertController.setup()  # TODO remove after issue fixed
295 295

  
296
        if connexion.request.is_json:
297
            id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
298
        return 'do some magic!'
296
        try:
297
            v = int(id)
298
        except ValueError:
299
            return E_WRONG_PARAMETERS, 400
300

  
301
        cert = CERTIFICATE_SERVICE.get_certificate(v)
302

  
303
        if cert is None:
304
            return E_NO_CERTIFICATES_FOUND, 205  # TODO related to 204 issue
305

  
306
        ret = []
307

  
308
        while True:
309
            cert = CERTIFICATE_SERVICE.get_certificate(cert.parent_id)
310
            if cert is None:
311
                return E_CORRUPTED_DATABASE, 500
312
            elif cert.parent_id == cert.certificate_id:
313
                break
314
            ret.append(cert.pem_data)
299 315

  
316
        return {"success": True, "data": "".join(ret)}
300 317

  
301 318
    @staticmethod
302 319
    def cert_to_dict_partial(c):

Také k dispozici: Unified diff